今天小编跟大家讲解下有关科技常识:ahjesus安装mongodb企业版for ubuntu的步骤,相信小伙伴们对这个话题应该也很关注吧,小编也收集到了有关科技常识:ahjesus安装mongodb企业版for ubuntu的步骤的相关资料,希望小伙伴会喜欢也能够帮助大家。
导入共匙复制代码代码如下:sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
创建源列表复制代码代码如下:echo 'deb https://repo.mongodb.com/apt/ubuntu precise/mongodb-enterprise/stable multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
刷新包复制代码代码如下:sudo apt-get update
安装企业版复制代码代码如下:sudo apt-get install mongodb-enterprise
防止意外升级到最新版,可以运行如下命令复制代码代码如下:echo"mongodb-enterprise hold"| sudo dpkg --set-selectionsecho"mongodb-enterprise-server hold"| sudo dpkg --set-selectionsecho"mongodb-enterprise-shell hold"| sudo dpkg --set-selectionsecho"mongodb-enterprise-mongos hold"| sudo dpkg --set-selectionsecho"mongodb-enterprise-tools hold"| sudo dpkg --set-selections启动运行复制代码代码如下:sudo /etc/init.d/mongod start
验证启动成功
验证是否启动成功可以到日志文件查看,具体位置在 /var/log/mongodb/mongod.log.
停止复制代码代码如下:sudo /etc/init.d/mongod stop
重启复制代码代码如下:sudo /etc/init.d/mongod restart
附:update失败 提示有一个旧项的解决办法
更新源至国内我用的是阿里云的源具体的操作是 vi /etc/apt/sources.list 在文件最前面添加以下条目(!!!操作前请做好相应备份!!!)
复制代码代码如下:deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
来源:爱蒂网