Rocky Linux 安装 Mongodb5.0 Enterprise
1、安装仓库
cd /etc/yum.repos.d
vim mongodb-enterprise-5.0.repo
[mongodb-enterprise-5.0]
name=MongoDB Enterprise Repository
baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/5.0/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-5.0.asc
sudo yum install -y mongodb-enterprise
systemctl enable mongod.service
systemctl start mongod.service
systemctl status mongod.service
2、创建账号
mongo
use admin; //admin库进行身份认证
db.createUser({user: "myuser",pwd: "123456",roles: ["root"]});
3、启用身份验证
vim /etc/mongod.conf
3.1 启用外网访问
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
3.2 启用身份验证
#security:
security:
authorization: enabled
官网地址:https://www.mongodb.com/docs/manual/tutorial/install-mongodb-enterprise-on-red-hat/