Groupadd-g-MongoDB
Useradd-u 801-g MongoDB MongoDB
cd/usr/local/
mkdir MongoDB
CD mongodb/
#mkdir bin
mkdir conf
mkdir Log
mkdir data
cd/root/
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.6.4.tgz
Tar XF mongodb-linux-x86_64-rhel62-3.6.4.tgz
CD mongodb-linux-x86_64-rhel62-3.6.4
CP */USR/LOCAL/MONGODB
Cd/usr/local
Chown-r Mongodb.mongodb mongodb/
cd/root/
VI. bash_profile
Export Path=/mongodb/bin: $PATH
source. bash_profile
Vim/usr/local/mongodb/conf/mongodb.conf
Logpath=/usr/local/mongodb/log/mongodb.log
Dbpath=/usr/local/mongodb/data
#directoryperdb =true
port=27017
bind_ip=0.0.0.0
Logappend=true
Fork=true
Cpu=true
Auth=true
Netstat-nputl
Mongod-f/usr/local/mongodb/conf/mongodb.conf
Mongod--shutdown-f/usr/local/mongodb/conf/mongodb.conf
Mongo
Db
Show DBS
Use admin
Db.auth ("admin", "xld.2018")
Db.system.users.find ()
Db.createuser ({User: "admin", pwd: "xld.2018", roles:["root"}) Create Super Admin
Db.createuser ({User: "Xwgl", pwd: "xld.2018", roles:[{Role: "DbAdmin", DB: "XWGL"}]}) Create a single database administrator
mongodb3.6.4 Installation