您的位置:首页 > 数据库 > Mongodb

Ubuntu 14.04 LTS 安装 MongoDB

2016-08-25 00:14 405 查看
参考mongo官方文档的安装方法

官方文档

1、导入公钥.

The Ubuntu package management tools (i.e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import the MongoDB public GPG Key

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927




2、创建MongoDB列表文件.

Create the /etc/apt/sources.list.d/mongodb-org-3.2.list list file using the command appropriate for your version of Ubuntu:

我用的14.04

输入如下命令

echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list




3、更新数据源.

sudo apt-get update




4、安装MongoDB.

安装最新版的命令

sudo apt-get install -y mongodb-org


完成之后执行如下命令

echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections




启动Mongo

sudo service mongod start




输入

mongo


就可以使用Mongo Shell了



参考文献

官方文档
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mongodb