1: Download MongoDB 2.6 version
Https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.6.9.zip
2: Unzip
TAR-ZXVF Mongodb-linux-x86_64-2.6.9.zip
MV mongodb-linux-x86_64-2.6.9 MongoDB
3: Create data directory and log directory and conf configuration file in MongoDB directory
Both data and log directories are guaranteed to have read and write access
4: Edit config file vi mongo.conf
Add logappend=true# to the =/root/software/mongodb/log/mongod# Data Catalog dbpath=/root/software/mongodb/data# log in Append mode #日志目录logpath Turn on background process run fork = true# Port = 27017
5: Start the Mongod with the configuration file
./bin/mongod--config mongo.conf
6: Connect MONGO
7: Add user name and password
Db.adduser ("Gechong", "password")
Certified Users:
Db.auth ("Gechong", "password") 1
View User
Db.auth ("Gechong", "password") 1
Add a user with read and write permissions to the test library
> Use testswitched to DB test >db.adduser ("GE", "password") warning:the ' addUser ' shell Helper is DEPRECATED. Please use ' createUser ' insteadsuccessfully added User: {"user": "GE", "Roles": ["Dbowner"]}
Add a read-only client to the test library
Db.adduser ("Geread", "password", true)
Remove Invalid User
Db.system.users.remove ({User: "Geread"})
Next Blog: http://www.cnblogs.com/xiaoit/p/4478951.html
MongoDB Replica Set Configuration series one: Installing MongoDB