1.sudo vim /etc/yum.repos.d/mongodb-org-3.6.repo
1.[mongodb-org-3.6]
2.name=MongoDB Repository
3.baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/testing/x86_64/
4.gpgcheck=1
5.enabled=1
6.gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc
1.sudo yum clean all
1.sudo yum makecache
临时
关闭selinux
1.[root@centos-1]# setenforce 0
将selinux的参数改为“
disabled
”,这可以永久关闭selinux
1.[root@centos-1]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
or
1.vi /etc/selinux/config
1.sudo service mongod start
注意,一定不要使用systemctl start mongod
1.sudo chkconfig mongod on
注意,一定不要使用systemctl enable mongod
步骤6、7是导致启动失败的主要原因,因此建议严格按照说明操作
1.sudo service mongod stop
1.sudo yum erase $(rpm -qa | grep mongodb-org)
1.sudo rm -r /var/log/mongodb
2.sudo rm -r /var/lib/mongo
参考链接:http://t.cn/RW0U23p