How to Install MongoDB on Ubuntu

Step by Step Guideline on Installing MongoDB on Ubuntu

MongoDB is an ultimate free, open-source, distributed, NoSQL, document database, which serves as the common purpose in modern web applications. It features horizontal scaling, high availability & geographical distribution. There are many things that it supports like Ad hoc queries, indexing, and even real-time aggregation. If you wish to use MongoDB on Ubuntu, it is needful for you to Install MongoDB it first in your system.

In this MongoDB tutorial, you will be understanding installing more simply. So, let’s begin the process, as we have presented a step by step guide, which you can follow for the installation. You will realize a smooth installation in no time if you follow as instructed in this guide.

Step 1: Install MongoDB Package

One gets MongoDB inclusive in the package of Ubuntu Repositories, but considering the official MongoDB repositories, you are provided with a more advanced, up to date version. And it is the ideal way recommended by us to install the software. In this step, one needs to add official repositories into your server. Ubuntu verifies the authenticity of the to-be-installed software by checking that it’s signed with GPS keys.
Importing the key store for official repository

After successful importing, add MongoDB details, to let apt know where the package needs to be downloaded from. By following the below command:

Once it is done, updating the package list is the next command to be followed:

Step 2: Verifying MongoDB

After accomplishing the first step, you can move further with the installation of the package itself. Below command will help you install multiple packages that hold the latest version including management tools to help you for the MongoDB server.

Once done, start your MongoDB with, systemct1, and you can also check through it if the system service has started properly:

After this, you will see the output results like this:


Now, the last step in the verification process is to enable automatically starting of MongoDB as soon as the system starts. This can be performed with the help of the command given below:

Step 3: Adjusting Firewall (Optional)

Assuming that you have understood and gone through all the necessary steps needed, next is to enable the firewall on your server. If you wish to use the MongoDB server for local needs with applications that would be running on the same server. Then, it is highly recommended for you to make a secure setting. You need to allow the incoming connections to ufw

If you wish to allow access from everywhere on the default port of 27017, one can use the following command properly:

Remember, MongoDB should be accessed only through trusted locations. To make it accomplish, allow access on MongoDB’s default port when you are specifying the IP address of other servers, that would be allowed to connect: Following is the command you can need to address, to accomplish the task:

Now that you have understood how to go about it, make sure you follow the steps properly. Your query about How to Install MongoDB on Ubuntu will be solved easily if you make every introduced here, properly.

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *