How to install Mongo DB on Ubuntu 16.04

By | 16 June, 2016
Share Article

MongoDB is a cross-platform, document oriented, No Sql database. MongoDB provides high performance, high availability, and easily scalable. MongoDB works on concept of collection and document. The official Ubuntu 16.04 MongoDB packages have not been published till now by the MongoDB maintainers. In this article i am going to explains you that “How to install MongoDB on Ubuntu 16.04

To install MongoDB on your Ubuntu 16.04 follow this steps :-

  1. First login with root user. For this press CTRL + ALT + T or open terminal and type this command

    This will prompt you for your password, enter your password and press enter key.
  2. Now we need to add MongoDB repository on your Ubuntu 16.04 package repositories. By default MongoDB is already comes in Ubuntu package repositories but to install the latest version of MongoDB to Ubuntu 16.04 installation we add the official MongoDB repository to our Ubuntu 16.04 installation. To add this run this command

    Once you run this command you will see an output like



    To install any package or software in Ubuntu we use apt command. So now we have to MongoDB repository details so apt can know from where it need to download the MongoDB Packages. For this use this command

    Now we need to update Ubuntu 16.04 package list. For this use this command.
  3. So now we are ready install the MongoDB on our machine. For this use this command

    This command will install MongoDB also some helpful tools for  management of the MongoDB. Now we need to add MongoDB as a service on Ubuntu 16.04. For this we need to create a unit file which will describe MongoDB as service to Ubuntu 16.04. So we can start or stop the MongoDB service. So now we need to create a file named mongodb.service under the /etc/systemd/system directory.  For this use this command

    This command will create the file and open for editing. Now paste the below codes into this file

    Now just start the MongoDB Service. For this use this command

    This command will start the MongoDB. Hence, this command does not return any output. So, if need you can check service status using this command

    In case you want to stop the MongoDB service use this command

    In case you need to restart the  MongoDB service

    So, it done, We successfully installed the MongoDB on Ubuntu 16.04.

Leave a Reply

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