導(dǎo)入共匙
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
創(chuàng)建源列表
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
安裝企業(yè)版
sudo apt-get install mongodb-enterprise
防止意外升級到最新版,可以運行如下命令
echo "mongodb-enterprise hold" | sudo dpkg --set-selections
echo "mongodb-enterprise-server hold" | sudo dpkg --set-selections
echo "mongodb-enterprise-shell hold" | sudo dpkg --set-selections
echo "mongodb-enterprise-mongos hold" | sudo dpkg --set-selections
echo "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失敗 提示有一個舊項的解決辦法
更新源至國內(nèi)
我用的是阿里云的源
具體的操作是 vi /etc/apt/sources.list 在文件最前面添加以下條目(?。?!操作前請做好相應(yīng)備份!??!)
deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse