1, Mongodb:http://www.mongodb.org/downloads, can find 32-bit tgz file address, such as: http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.4.2.tgz
2. Install MongoDB (install to/usr)
Cd/usr
wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.4.2.tgz
Tar zxvf mongodb-linux-i686-2.4.2.tgz
MV mongodb-linux-i686-2.4.2 MongoDB (file Rename, move file and rename are the same command, MV (is the move) meaning)
CD MongoDB
mkdir data
CD data
mkdir db (Set up data file directory)
Cd.. /
mkdir logs (build log directory)
CD bin
VI mongodb.conf
3, mongodb.conf file input as follows:
DBPATH=/DATA/DB (see the W3cschool, the data directory can only be on the root directory, or there will be a problem from booting)
Logpath=/usr/mongodb/logs/mongodb.log
port=27017
Fork=true
Nohttpinterface=true
4. Enter the contents of the command line, rebind the configuration file address of MongoDB and access IP
/usr/mongodb/bin/mongod--bind_ip localhost-f/usr/mongodb/bin/mongodb.conf
5, Boot automatically start MongoDB
Vi/etc/rc.d/rc.local
/usr/mongodb/bin/mongod--config/usr/mongodb/bin/mongodb.conf (file input content)
6, restart the system, test can be self-starting
#进入mongodb的shell模式
/usr/mongodb/bin/mongo
#查看数据库列表
Show DBS
#当前db版本
Db.version ();
7. Configure Environment variables
Vi/etc/profile #添加环境变量, edit, and add the following code to the last line:
Export path= $PATH:/usr/mongodb/bin
Restart your computer after saving. This allows the database to be connected directly to the MONGO, without the need to enter/usr/mongodb/bin/mongo into MongoDB's shell mode like 5.
8, if after a startup, found that the input MONGO can not connect to the database, probably because the last time the shutdown caused by the failure, at this time to delete the/data/db directory mogod.lock files, restart.
9. MongoDB Management tool: Robomongo
CentOS Installation MongoDB