vim /etc/yum.repos.d/mongodb-org-4.0.repo
---begin
[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
---end
查看repolist
yum repolist all|grep mongodb
安装
yum install -y mongodb-org
启动
systemctl start mongod