ubuntu一键安装mongodb最新版

官网安装步骤镇楼

秘钥
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 &
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值