1、下载MongoDB(64位)
http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.9.tgz
或
http://pan.baidu.com/s/1mgyRB8c
2、安装MongoDB(安装到/usr/local)
tar zxvf mongodb-linux-x86_64-2.4.9.tgz mv mongodb-linux-x86_64-2.4.9 mongodb cd mongodb mkdir db mkdir logs cd bin vi mongodb.conf
dbpath=/usr/local/mongodb/db logpath=/usr/local/mongodb/logs/mongodb.log port=27017 fork=true nohttpinterface=true
3、重新绑定mongodb的配置文件地址和访问IP
/usr/local/mongodb/bin/mongod --bind_ip localhost -f /usr/local/mongodb/bin/mongodb.conf
4、开机自动启动mongodb
vi /etc/rc.d/rc.local
/usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb.conf
5、重启一下系统测试下能不能自启
#进入mongodb的shell模式 /usr/local/mongodb/bin/mongo #查看数据库列表 show dbs #当前db版本 db.version();
[root@t mongodb]# ./bin/mongod --dbpath /usr/mongodb/data/db/ --logpath /usr/mongodb/data/logs/mo --port 27017
about to fork child process, waiting until server is ready for connections.
forked process: 2299 child process started successfully, parent exiting
[root@t mongodb]# ps aux|grep mongo
root 2299 1.1 5.0 475040 50496 ? Sl 21:33 0:01
./bin/mongod --dbpath /usr/mongodb/data/db/ --logpath /usr/mongodb/data/logs/mongodb.log --fork --port 27017
root 2314 0.0 0.0 103248 832 pts/0 S+ 21:34 0:00 grep mongo
MongoDb启动报错:ERROR: child process failed, exited with error number xx
http://blog.csdn.net/u010028869/article/details/50698689
原文:http://www.cnblogs.com/tianboblog/p/5982793.html