Setup MongoDB on CentOS
Make sure your system is up-to-date.
sudo yum -y update
|During this installation some files will need to be edited manually. If you are familiar with vim set it as default editor with the commands below. If you are not familiar with vim please skip this and keep using the default editor.|
sudo yum -y install vim sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim 100
Follow the official MongoDB installation guide for CentOS.
If you are going to install Relution on another machine, you need to configure MongoDB to listen on all network interfaces. If Relution is going to be installed on the same machine you can skip these steps.
sudo editor /etc/mongod.conf
Find the following section:
# network interfaces net: port: 27017 bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
bindIp so that it looks like this:
# network interfaces net: port: 27017 # bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
Restart the MongoDB service for the changes to take effect:
sudo systemctl restart mongod.service
Verify MongoDB is running as expected:
sudo cat /var/log/mongodb/mongod.log
You should see a message similar to:
... NETWORK [initandlisten] waiting for connections on port 27017
You can now use the command line utility to connect to the MongoDB instance.
exit to disconnect again.
If you’re going to install Relution on another machine, you need to open
27017 on this machine, so Relution can talk to MongoDB. If
Relution is going to be installed on the same machine you can skip these
Replace ADDRESS with the IP address and netmask of the
machine or network you want to grant access to this MongoDB instance.
sudo firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="###ADDRESS###" port protocol="tcp" port="27017" accept' sudo firewall-cmd --reload