How to Install MongoDB on Ubuntu

MongoDB is a free and open-source NoSQL document database used commonly in modern web applications.

Step 1 — Adding the MongoDB Repository

At first, navigate to and choose your Ubuntu version. The Ubuntu version name is at

Then navigate to, get the key from the version exist on both and MongoDB 3.4 is my choice.

Run the following command:
$ sudo apt-key adv --keyserver hkp:// --recv A15703C6

Create a list file for MongoDB:
$ echo "deb [ arch=amd64 ] xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

Update the package list:
$ sudo apt update

Step 2 — Installing and Verifying MongoDB

Run the following command:
$ sudo apt install -y mongodb-org

Check MongoDB service status:
$ service mongod status

Run MongoDB Community Edition
  • Start:
    $ sudo service mongod start
  • Stop:
    $ sudo service mongod stop
  • Restart:
    $ sudo service mongod restart
Uninstall MongoDB Community Edition
This process will completely remove MongoDB, its configuration, and all databases. This process is not reversible, so ensure that all of your configuration and data is backed up before proceeding.
$ sudo service mongod stop
$ sudo apt purge mongodb-org*
$ sudo rm -r /var/log/mongodb
$ sudo rm -r /var/lib/mongodb

Read MongoDB manual - Installation here


  1. It comes in two structures to be specific Windows VPS just as Linux VPS. A Windows VPS is unquestionably increasingly mainstream as it is perfect with heaps of programming and programs and consequently it fills changed needs for various prerequisites of organizations.

  2. Customization of your server is also possible in case of Windows VPS or Cheap VPS.