How to Install MongoDB on Ubuntu 18.04

r00t May 29, 2018

Install MongoDB on Ubuntu 18.04

In this tutorial well learn how to install MongoDB on Ubuntu 18.04. We will also install and configure its prerequisites. MongoDB is an open source, document database based on the cutting edge technology of NoSQL. It supports development of modern web applications, with features such as strong consistency, flexibility, expressive query languages and secondary indexes plus a lot more.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 18.04 LTS minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install MongoDB on Ubuntu 18.04

Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:

apt-get update -y && apt-get upgrade -y

Step 2. Installing MongoDB on Ubuntu 18.04 LTS system.

First, add the official MongoDB repository:

sudo apt-key adv --keyserver hkp:// --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

After that, we now have to add a file containing the MongoDB repository details under our /etc/apt/sources.list.d/ from which package files will be fetched:

echo "deb [ arch=amd64,arm64 ] xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list

To start installing MongoDB from the repository we just added, we issue the command:

sudo apt update
sudo apt install -y mongodb-org

Step 3. Verifying MongoDB.

After installation the MongoDB database does not start by default. To start the database enter:

sudo systemctl start mongod.service
sudo systemctl enable mongod.service

Confirm the MongoDB status:

sudo systemctl status mongod.service

You should see something like the lines below:$ sudo systemctl status mongod
● mongod.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2018-05-27 08:53:42 CST; 13min ago
 Main PID: 2383 (mongod)
    Tasks: 46
   Memory: 60.7M
      CPU: 4.613s
   CGroup: /system.slice/mongod.service
           └─2383 /usr/bin/mongod --config /etc/mongod.conf

May 27 08:53:42 ubuntu1604 systemd[1]: Started High-performance, schema-free document-oriented database.
May 27 09:05:49 ubuntu1604 systemd[1]: Started High-performance, schema-free document-oriented database.

Step 4. Connecting MongoDB Terminal.

Once the installation is done, you can connect to MongoDB terminal and execute the commands for the tasks you want to do:


Congratulation’s! You have successfully install and configured Adobe Flash Player on your Ubuntu 18.04 LTS server. Thanks for using this tutorial installing Adobe Flash Player on Ubuntu 18.04 LTS (Bionic Beaver) system.


The Tags:

Leave a Comment

Comments are closed.