Professional Documents
Culture Documents
CentOS/RHEL
MongoDB is a free & open-source No-SQL database, it uses JSON like document format to
store data in the database which is unlike the SQL database, where data is stored in a row &
column-based format.
MongoDB is very fast & has great performance when compared to the SQL database.
MongoDB databases are very easy to scale & they also address various shortcomings that
other SQL databased present. MongoDB is completely ideal for the types of DB required to
handle the data that we have today i.e. big data, IoT, online gaming, etc.
# vim /etc/yum.repos.d/mongodb-org-4.2.repo
[mongodb-org-4.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc
Save file & exit. Then we can install mongodb with the following command,
This will install mongodb & all its associated components on your server.
# mkdir -p /data/mongodb
# wget https://fastdl.mongodb.org/linux/mongodb-linux-s390x-rhel72-4.2.2.tgz
# ln -s /data/mongodb/bin/* /usr/local/bin/
# mkdir -p /var/lib/mongo
# mkdir -p /var/log/mongo
Note: When installing using yum, all these folders are created by system only with required
permissions.
# mongo
# vi /etc/mongod.conf
net.bindIp 0.0.0.0
You can also change & mention a single remote IP address if you only need to connect from a
single remote system. After making the changes, you need to restart the database to implement
the changes made,
Note:- If running database through CLI, we can mention the parameter “–bind_ip” followed by
‘0.0.0.0’ for connecting from all remote IPs or we can also mention a single IP address.
That’s it guys, we now end this tutorial on how to install MongoDB on CentOS & RHEL. Please
do send us your questions, queries & suggestions using the comment box below.
If you think we have helped you or just want to support us, please consider these:-
TheLinuxGURUS.com