Hello Everyone, In this article, we will learn about how to install MongoDB on Ubuntu 18.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.
- For Ubuntu 14.04 version, please check my previous article Install MongoDB on Ubuntu 14.04
- For Ubuntu 16.04 version, please check my another article Install MongoDB on Ubuntu 16.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 18.04 version.
Install MongoDB on Ubuntu 18.04 Version
- Ubuntu 18.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 18.04 Version
Step 1: Update Ubuntu packages
The best part about Ubuntu 18.04, which I like personally is MongoDB comes as in build package with Ubuntu Server. But before the direct start, the install process, let’s first update the Ubuntu package. For update run below command.
$ sudo apt update
Step 2: Install the MongoDB package
As I mentioned in Step 1 as MongoDB pacakge comes with Ubuntu 18.04 server and before we updated our package manager so now only one thing left which is simply install the MongoDB pacakge. For instalation, please run below command.
$ sudo apt install -y mongodb
The installation process is depending on your internet connection also, because it will first download then will install several packages as well as dependencies which are required for MongoDB package.
Step 3: 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 mongodb
Congratulation, You installed MongoDB into Ubuntu 16.04 version as well as started successfully.
Step 4: Check, Stop and Restart 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 mongodb
If you want to Stop mongoDB service, then simply run below command.
$ sudo systemctl stop mongodb
If you want to restart MongoDB service, then simply run below command.
$ sudo systemctl restart mongod
Note:- By default, MongoDB is configured to start automatically with the server.
If you want to disable it, then simply run below command.
$ sudo systemctl disable mongodb
If you want to enable it, then simply run below command.
$ sudo systemctl enable mongodb
I hope, you learn about how to install MongoDB on Ubuntu version 18.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