爆款云服务器低至4折,1核1G¥366/

创建 MongoDB repo 文件

vim /etc/yum.repos.d/mongodb-org-4.0.repo

文件内容为:

[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

安装 MongoDB 4.0

yum update -y
yum install -y mongodb-org

启动 MongoDB

systemctl start mongod
systemctl enable mongod

官方文档:https://docs.mongodb.com/master/tutorial/install-mongodb-on-red-hat/

标签: CentOS, MongoDB