参考:http://docs.mongodb.org/master/tutorial/install-mongodb-on-red-hat/
创建文件/etc/yum.repos.d/mongodb-org-3.0.repo
写入:
[mongodb-org-3.0]
name=MongoDB Repository
baseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1
#yum install -y mongodb-org
//启动
#service mongod start
//命令行进入mongodb,看到箭头即可。
#mongo
>
如果远程无法连接,修改防火墙,尝试修改/etc/mongod.conf
bind_ip=0.0.0.0
port=27017
httpinterface=true
为了能在http://ip:28017看到mongo状态信息,还需要修改/etc/mongod.conf
不修改会提示错误信息:
REST is not enabled. use --rest to turn on.
check that port 28017 is secured for the network too.
在/etc/mongod.conf加入这么一行即可
rest=true