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

ubuntu一键安装mongodb最新版

2017-03-09 23:56 375 查看
官网安装步骤镇楼

秘钥
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

14.04的源
echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

16.04的源
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

升级apt-get
sudo apt-get update

安装喽
apt-get install -y mongodb-org --force-yes


配置文件在哪里

Run MongoDB Community Edition¶

The MongoDB instance stores its data files in /var/lib/mongodb and its log files in /var/log/mongodb by default, and runs using the mongodb user account. You can specify alternate log and data file directories in /etc/mongod.conf. See systemLog.path and storage.dbPath for additional information.

If you change the user that runs the MongoDB process, you must modify the access control rights to the /var/lib/mongodb and /var/log/mongodb directories to give this user access to these directories.


启动
sudo service mongod start


关闭
sudo service mongod stop


源码安装

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-3.4.2.tgz tar -zxvf mongodb-linux-x86_64-ubuntu1404-3.4.2.tgz
cd mongodb
cp -R -n mongodb-linux-x86_64-ubuntu1404-3.4.2/ mongodb
cd mongodb-linux-x86_64-ubuntu1404-3.4.2/
mv * ../
rm -rf mongodb-linux-x86_64-ubuntu1404-3.4.2/
vim /etc/profile
PATH="/letv/Downloads/mongodb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/root/Downloads/WebStorm-163.9166.30/bin:/root/Downloads/pycharm-2016.3.2/bin:/root/Downloads/idea-IC-163.9166.29/bin"
source /etc/profile
mkdir -p /data/db
mongod --dbpath /data/db &
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mongodb ubuntu