Ubuntu14上安装Mongo3.2

1. 安装

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D68FA50FEA312927
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
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start

2. 允许远程连接

sudo vim /etc/mongod.conf
bindIp处改为 bindIp = 0.0.0.0

sudo service mongod restart

3. auth设置

sudo vim /etc/mongod.conf bind_ip
添加:
  security:
      authorization: enabled

sudo service mongod restart

4. 新建数据库及用户

use order
db.createCollection('OrderInfo')
db.createUser(
{
 user: "order",
 pwd: "123456",
 roles: [ "readWrite", "dbAdmin" ]
})

 

posted @ 2017-02-28 15:37  栖息之鹰  阅读(155)  评论(0编辑  收藏  举报