Hello Everyone, In this article, we will learn about how to install MongoDB on Ubuntu 16.04 version. As of now, Ubuntu comes with version 18.04 also but still there are so many users are using Ubuntu 14.04 as well as Ubuntu 16.04.
If you are using Ubuntu 14.04, then please check my previous article Install MongoDB on Ubuntu 14.04
Before jump to the installation process, let’s get a simple introduction about MongoDB and Ubuntu.
Introduction to MongoDB
MongoDB is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with the schema.
As of now, MongoDB is using by so many organizations as well as using in top 500 fortune companies also.
If you want to know more about MongoDB, then you can visit The MongoDB official Website.
Introduction to Ubuntu
Ubuntu is a free and open source operating system and Linux distribution based on Debian. Ubuntu is offered in three official editions: Ubuntu Desktop for personal computers, Ubuntu Server for servers.
I personally love Ubuntu because Ubuntu comes with so very easy to use and effective interface and easy to learn too. As mentioned above, currently Ubuntu comes with version 18.04 as well as Ubuntu is using by so many organization who worked in IoT, Servers etc.
If you want to know more about Ubuntu, then you can visit The Ubuntu Official Website.
Now the time came to know about steps as of how to install MongoDB on Ubuntu 16.04 version.
Install MongoDB on Ubuntu 16.04 Version
- Ubuntu 16.04 version should be installed as OS either as your system OS or in the virtual machine.
- sudo non-root user access to make sure, User can able to perform steps.
Steps for Install MongoDB on Ubuntu 16.04 Version
Step 1: Importing the Public Key
First, we will import the MongoDB GPG public key. The official MongoDB repository provides key to make ensure the authenticity of software packages by verifying that they are signed with GPG keys
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
Step 2: Add MongoDB Repository details in Ubuntu Repo file.
Once we will import public key successfully, then we need to add MongoDB repository details into Ubuntu repo file. Adding just run below 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
This command will add MongoDB repo information to Ubuntu repo file.
Step 3: Update Ubuntu packages
Whenever we will add or make any changes into Ubuntu repo list, we need to update it. For update run below command.
$ sudo apt-get update
Step 4 : Install MongoDB
Update process usually takes some time, but once Step 3 complete successfully, you are ready to install MongoDB. For installing , please run below command.
sudo apt-get install -y mongodb-org
Installation process is depending on your internet connection also, because it will first download then will install.
Step 5 : Start MongoDB service
Once MongoDB installation will be done, Now, you need to start Mongod service. You can start by using the below command.
sudo systemctl start mongod
Congratulation, You installed MongoDB into Ubuntu 16.04 version as well as started successfully.
Step 6: Check and Stop MongoDB Service
This is an optional step, which you can try later based on your requirement. If you want to check MongoDB status, then simply run below command.
$ sudo systemctl status mongod
If you want to Stop mongoDB service, then simply run below command.
$ sudo systemctl stop mongod
I hope, you learn about how to install MongoDB on Ubuntu version 16.04. In case of any confusion, you can comment down and I will try my best to reply as soon as possible.
For other tutorials, related to MongoDB and other big data technology, please visit my website