#源码包安装mongodb #方法一: [root@localhost application]# ls mongodb-linux-x86_64-2.4.9.tgz [root@localhost application]# tar zxvf mongodb-linux-x86_64-2.6.9.tgz [root@localhost application]# mkdir /mongo/ [root@localhost application]# mv mongodb-linux-x86_64-2.6.9 /mongo/mongodb [root@localhost application]# cd /mongo/mongodb [root@localhost mongodb]# mkdir conf [root@localhost mongodb]# mkdir logs [root@localhost mongodb]# mkdir database/ [root@localhost mongodb]# cd conf #新建主配置文件 [root@localhost conf]# vim mongodb.conf fork = true port = 30000 dbpath=/mongo/mongodb/database/ logpath=/mongo/mongodb/logs/mongodb.log directoryperdb = true maxConns = 20000 oplogSize = 1024 journal = true slowms = 200 quiet = true profile = 1 #启动mongo mongod -f mongodb.conf #查看端口 [root@localhost mongodb]# netstat -tulnp | grep :33000 tcp 0 0 0.0.0.0:30000 0.0.0.0:* LISTEN 16178/mongod #登陆mongo [root@localhost mongodb]# /mongo/mongodb/bin/mongo --port 30000
#方法二: [root@localhost application]# ls mongodb-linux-x86_64-2.4.9.tgz [root@localhost application]# mkdir -p /usr/local/mongodb [root@localhost application]# mkdir -p /var/mongodb/data [root@localhost application]# mkdir -p /var/mongodb/logs [root@localhost application]# groupadd -r mongodb [root@localhost application]# useradd -r -g mongodb -s /sbin/nologin mongodb [root@localhost application]# tar -zxv -f mongodb-linux-x86_64-2.4.9.tgz [root@localhost application]# mv mongodb-linux-x86_64-2.4.9 mongodb [root@localhost application]# chown -R mongodb:mongodb mongodb [root@localhost application]# /application/mongodb/bin/mongod --dbpath=/var/mongodb/data --logpath=/var/mongodb/logs/mongodb.log --fork about to fork child process, waiting until server is ready for connections. forked process: 15183 all output going to: /var/mongodb/logs/mongodb.log child process started successfully, parent exiting [root@localhost /]# /application/mongodb/bin/mongo --port 27017
本文出自 “吴善强” 博客,请务必保留此出处http://shanqiangwu.blog.51cto.com/8067564/1650570
原文地址:http://shanqiangwu.blog.51cto.com/8067564/1650570