9、CentOS 安装MongoDB

1、配置Repo源

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

编辑以下内容

[mongodb-org-3.4]  

name=MongoDB Repository  

baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/  

gpgcheck=1  

enabled=1  

gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc  

2、安装

yum -y install mongodb-org

3、配置SELinux

semanage port -a -t mongod_port_t -p tcp 27017  

4、设置开机启动

systemctl enable mongod.service

5、启动|重启|关闭

启动 :systemctl start mongod.service

重启 :systemctl restart mongod.service  

关闭 :systemctl stop mongod.service

6、开启远程访问

vim /etc/mongod.conf

注释掉下面代码

7、重启生效

systemctl restart mongod.service

猜你喜欢

转载自blog.csdn.net/crystalcs2010/article/details/81458356