1. To download the installation package:
Java code
- wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.0.3.tgz
2. Extract:
Java code
- TAR-ZXVF mongodb-linux-i686-2.0. 3.tgz
3. Specify the installation directory:
Java code
- MV mongodb-linux-i686-2.0. 3.tgz/usr/local/mongodb
4. New MongoDB Data File storage directory:
Java code
- Mkdir-p/data0/mongodn/db
5. New log file storage directory:
Java code
- Mkdir-p/data0/mongodn/logs
6.
Java code
- Cd/usr/local/mongodb/bin
7. New configuration file, MongoDB support to write the parameters into the configuration file, and then the configuration file configuration to start, we also use this method here. Perform:
Java code
- VI mongodb.conf
Add the following:
Java code
- DBPath =/data0/mongodb/db #数据文件存放目录
- LogPath =/data0/mongodb/logs/mongodb.log #日志文件存放目录
- Port = 27017 #端口
- Fork = true #以守护程序的方式启用, which runs in the background
- Nohttpinterface = true
Rebind the configuration file address and access IP for MongoDB:
Java code
- /usr/local/mongodb/bin/mongod--bind_ip localhost-f/usr/local/mongodb/bin/mongodb.conf
8. Start the MONGO program, start with the parameters defined by the configuration file mongodb.conf
Java code
- ./mongod--config mongodb.conf
9. Test, OK, installation successful!
MongoDB Installation Reference http://gevin.me/289.html
Boot auto Start MongoDB
Perform:
Java code
- Vi/etc/rc.d/rc.local
In the file, add:
Java code
- /usr/local/mongodb/bin/mongod--config/usr/local/mongodb/bin/mongodb.conf
CentOS Installation Configuration MongoDB