1、配置yum源文件
[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

2、yum安装mongodb
sudo yum install -y mongodb-org

3、启动mongodb
systemctl start mongod.service

4、查看mongodb
mongo


1、下载安装包并解压

curl https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.0.10.tgz

2、配置环境变量

export PATH=/bin:$PATH