下载 mongodb-linux-x86_64-3.2.8.tgz
tar -zxv -f mongodb-linux-x86_64-3.2.8.tgz
mv mongodb-linux-x86_64-3.2.8 /usr/local/mongodb
Cd in /usr/local/mongodb/
Touch mongodb.conf
Touch log/mongo.log
Chmod 777 mongo.conf
Chmod 777 log/mongo.log
配置 mongo config 文件[/usr/local/mongodb/]
Vi mongo.conf
############# mongodb.conf ################
port=3001
dbpath=data
logpath=log/mongodb.log
logappend=true
############# mongodb.conf ################
启动 mongo [/usr/local/mongodb/]
sudo bin/mongod -f mongodb.conf
vi /etc/sysconfig/iptables
添加:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3001 -j ACCEPT
Service iptables restart
原文链接:https://www.f2er.com/centos/380874.html