标签:登陆 官网 下载 write 上传 nload path pat 登陆用户
tar -zvxf mongodb-linux-x86_64-rhel62-3.4.3.tgz
firewall-cmd --zone=public --add-port=27017/tcp --permanent (--permanent永久生效,没有此参数重启后失效)
#重新载入
firewall-cmd --reload
cd mongodb-linux-x86_64-rhel62-3.4.3
mkdir data
touch logs
/apps/mongodb-linux-x86_64-rhel62-3.4.3/bin/mongod -dbpath=/apps/mongodb-linux-x86_64-rhel62-3.4.3/data -logpath=/apps/mongodb-linux-x86_64-rhel62-3.4.3/logs --fork --auth
cd /apps/mongodb-linux-x86_64-rhel62-3.4.3/bin
./mongo
use admin
db.createUser(
... {
... user: "admin",
... pwd: "admin",
... roles: [ { role: "root", db: "admin" } ]
... }
... )
db.auth(‘admin‘,‘admin‘);
use test
db.createUser(
... {
... user: "test",
... pwd: "test",
... roles: [ { role: "readWrite", db: "test" } ]
... }
... )
#设置开机启动
#修改/etc/下的rc.local添加如下命令
/apps/mongodb-linux-x86_64-rhel62-3.4.3/bin/mongod -dbpath=/apps/mongodb-linux-x86_64-rhel62-3.4.3/data -logpath=/apps/mongodb-linux-x86_64-rhel62-3.4.3/logs --fork --auth
标签:登陆 官网 下载 write 上传 nload path pat 登陆用户
原文地址:https://www.cnblogs.com/yvanme/p/13093808.html