-- 安装MongoDB
sudo yum install -y mongodb-org
启动MongoDB
--配置SELinux
方法一:
如果SELinux开启enforcing模式:
-
semanage port -a -t mongod_port_t -p tcp 27017
方法二:
如果禁用SELinux (修改配置文件的方式必须重启系统):
SELINUX=disabled
或
SELINUX=permissive
--启动MongoDB
- systemctl start mongod.service
--配置防火把27017端口号加到例外:
- firewall -cmd --permanent --add-port=27017/tcp
- firewall-cmd --reload
- systemctl restart firewalld.service
--设置开机启动
- systemctl enable mongod.service
--启动Mongo shell
- mongo
--设置mongodb远程访问:
编辑mongod.conf注释bindIp,并重启mongodb.
- vim /etc/mongod.conf
- systemctl restart mongod.service
--停止mongodb
- systemctl stop mongod.service
Mongodb的安装
标签:enabled tar www. 方法 端口号 selinux bsp repos /etc/