1.增加MongoDB仓库
vim /etc/yum.repos.d/mongodb.repo
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/
enabled=1
:wq退出编辑
2.安装MongoDB
yum -y update
yum -y install mongodb-org mongodb-org-server
3.运行MongoDB
输入mongod 运行MongoDB
4.永久运行MongoDB
mongod --fork --logpath /var/log/mongod.log
参考资料:https://www.liquidweb.com/kb/how-to-install-mongodb-on-centos-7/
http://stackoverflow.com/questions/8827615/how-do-you-keep-mongo-running-on-a-remote-server