####添加yum仓库
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
####yum安装
yum install -y mongodb-org
####启动mongodb
service mongod start
####报错
- 删除/tmp下面mongo.sock文件
rm /tmp/mongodb-27017.sock -fr
- 修改权限
chown -R mongod.mongod /var/lib/mongo
chown -R mongod.mongod /var/lib/mongodb
评论区