Installing and uninstalling MongoDB 3.4 using the Yum source on CentOS 7
1. Configure the Yum source
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. Installing MongoDB
Mongodb-org will contain mongodb-org-server, Mongodb-org-mongos, Mongodb-org-shell, Mongodb-org-tools
sudo yum install-y mongodb-org
3. Configure SELinux
Semanage port-a-t mongod_port_t-p TCP 27017
Or
Vi/etc/selinux/config
Selinux=disabled
Restart
Or
Vi/etc/selinux/config
Selinxu=permissive
Restart
4. Check data and log file access rights
The default data file in/var/lib/mongo, the default log file in/var/log/mongodb, is always granted Mongod user access when the file directory/etc/mongod.conf modified in the profile.
5. Modify Bind_ip
The default bind_ip is set to 127.0.0.1, modify as needed, and then restart the service.
6. Start the service
sudo chkconfig mongod on sudo service mongod start NETSTAT-TUNPL | grep 27017
Uninstalling MongoDB
The process will completely remove MongoDB, its configuration, and all databases.
1. Stop the Service
sudo service Mongod stop
2. Remove the Package
sudo yum erase $ (rpm-qa | grep mongodb-org)
3. Removing data and log files
sudo rm-r/var/log/mongodb sudo rm-r/var/lib/mongo
Reference:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
The source of this article: http://www.cgtblog.com/kafa/1589.html, reprint please indicate the source (spring Brother qq:2931393342: Wocgtblog)
Installing and uninstalling MongoDB 3.4 using the Yum source on CentOS 7