Install MongoDB on a CentOS VPS
MongoDB is a NoSQL document-oriented database. It is a cross-platform and it makes the process of data integration faster and much easier. Since it is free and open-source, MongoDB is used by number of websites and organizations. The installation of MongoDB on a Linux VPS is very simple and today we will show you how to do that.
We will use a CentOS VPS for this tutorial and we will start with a system update. For that purpose, you can use the following command:
Once your system is up to date, you can proceed with the other steps of the installation. We will show you how to install MongoDB on your Linux VPS using a .rpm package. Let’s add the official MongoDB repository to your system. Create a /etc/yum.repos.d/mongodb.repo file.
Then, using your favorite text editor, you need to edit the file. If you are using 64bit system, you need to add the following content to the /etc/yum.repos.d/mongodb.repo file:
[mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/ gpgcheck=0 enabled=1
Otherwise, if you are using a 32bit system you need to add the following content:
[mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/ gpgcheck=0 enabled=1
Save the file and close it. If you are done with the previous step you can use the yum package manager to install MongoDB on your CentOS VPS.
yum install mongo-10gen mongo-10gen-server
The installation should take only a few minutes and once it is over, you can start using the MongoDB. To start the service you can use:
Also, you can stop or restart the MongoDB service by using:
/etc/init.d/mongod stop /etc/init.d/mongod restart
The main configuration file is located in the /etc directory on your Linux VPS as mongod.conf. To edit it, you can use your favorite text editor.
To enable MongoDB on system startup, you can use the command:
chkconfig mongod on
If you like to check for errors or important messages you can watch the output in the log file:
A good way to start using MongoDB on your CentOS VPS is to read the MongoDB manual on the official web site.
You can find information such as first steps, basic database operations, FAQs and much more.
Of course you don’t have to do any of this if you use one of our Linux VPS hosting services, in which case you can simply ask our expert Linux admins to install MongoDB for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.