CentOS 7 安装MongoDB详细步骤
创建/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:
sudo yum install -y mongodb-org
配置mongod.conf
允许远程连接:
$ vim /etc/mongod.conf # Listen to all ip address bind_ip = 0.0.0.0
启动mongodb:
sudo service mongod start
创建管理员用户:
$ mongo >use admin db.createUser( { user: "myUserAdmin", pwd: "abc123", roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ] } )
启用权限管理:
$ vim /etc/mongod.conf #security security: authorization: enabled
重启mongodb:
sudo service mongod restart
大功告成!
相关推荐
lbyd0 2020-11-17
zhushenghan 2020-11-09
sunnnyduan 2020-10-16
sdmzhu 2020-09-01
mkhhxxttxs 2020-09-16
xiaohai 2020-09-16
apexlj 2020-08-16
BigYellow 2020-11-16
sushuanglei 2020-11-12
我心似明月 2020-11-09
不要皱眉 2020-10-14
xiaohai 2020-09-29
songxiugongwang 2020-09-22
萌亖 2020-09-17
LuckyLXG 2020-09-08
newcome 2020-09-09
jaylong 2020-08-19
大秦铁骑 2020-08-19