Home Linux Ubuntu 5 Steps to Install MongoDB on Ubuntu

5 Steps to Install MongoDB on Ubuntu

How can I install MongoDb on ubuntu linux??

This article will let you know the easy steps to install MongoDB.MongoDB is the open source community software and It’s very frequent for the system administrator, to install the software for the clients. Here I will let you know the 5 easy steps to install MongoDB on the Ubuntu machine.

READ MORE: How to Install MySQL on Ubuntu 18.04 Release

Step 1

First run the following command to add the repository in Ubuntu machine.

 # sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 
Add MongoDB repositoryAdd MongoDB repository

After above command, run this command:

 # echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list 

Step 2

Now update the Ubuntu packages.

#  sudo apt-get update 

Step 3

Now, we will run the installation command for the MongoDB on the ubuntu server.

# sudo apt-get install -y mongodb-org 
Install Mongodb commandInstall Mongodb command

After installing, start the MongoDB service.

# sudo systemctl start mongod 

Command to check the service status:

#  sudo systemctl status mongod 

Step 4

Enable the MongoDb service permanently on, even on the restart Ubuntu.

#  sudo systemctl enable mongod 

Step 5

By default, Ubuntu firewall is diabled. If you have enable Ubuntu firewall, need to allow MongoDb to through the firewall. To check the Ubuntu firewall active status, use this command:

#  sudo ufw status 

In case of firewall is set Active, then next step is to allow database port the through the firewall.

# sudo ufw allow 27017



Conclusion: You learned how to install MongoDB with easy 5 steps on Ubuntu machine.

LEAVE A REPLY

Please enter your comment!
Please enter your name here