1. Download the corresponding operating system and machine version
Website: https://www.mongodb.com/download-center?jmp=docs
My system is CentOS-6.6, 64-bit, so choose Red Hat version, because they have to say Yuanyuan.
2. Installation
2.1 Extracting the installation package into the/usr/local directory
TAR-ZXVF mongodb-linux-x86_64-rhel62-3.2.7.tgz
To establish a soft connection after renaming to mongodb-3.2.7:
Ln-s mongodb-3.2.7 MongoDB
2.2 Create the database folder and the log file in the/usr/local/mongodb directory.
Mkdir/usr/local/mongodb/data
Touch/usr/local/mongodb/logs 2.3 Adds the MongoDB Bin directory to path for system-wide use of the edit/etc/profile file, at the end of the add: and then through the Source Profile command Make the changes take effect immediately. 2.4 Write a simple script to launch the MongoDB 2.4.1 no password login script start-mongodb.sh content as follows:
Mongod--dbpath/opt/mongodb-data/data--logpath/opt/mongodb-data/logs/mongodb.log--journal--fork
Execute the script to open the Mongod service and set the password by MONGO the client to establish a new user. Creating a script creates a new user with the following content: Create result:
Password Setup is complete
The startup script is modified to:
Mongod--dbpath/opt/mongodb-data/data--logpath/opt/mongodb-data/logs/mongodb.log--journal--fork--auth
After the change is over, turn off the original Mongod service and then re-open the Mongod that requires password verification with a new script:
Test Service Status:
Successfully connected to the open MongoDB with the newly created user as shown
Installing MongoDB in Linux (CentOS)