NoSQL database is one of the most powerful database engine available in the market which is the backbone for different high-performance applications. In general, NoSQL is used in the applications where we will require extremely high read/write operations with low transactional requirements. e.g. If we are trying to build a Cluster Health statistics logging or Analytics engine or IoT application with power consumptions statistics, then NoSQL database should be the best possible database engine to be used. MongoDB is a very popular name in the NoSQL world which is there in the market since 2009. MongoDB has evolved very fast since it’s inception and currently dominating the market with it’s latest stable version 4.0.x

Today we will provide Step by step guide to install mongodb 4.0.x on Ubuntu 18.04 LTS x86_64 (64 bit) Operating system.

Configure APT repository:

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
$ echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org.list
$ sudo apt update

Install MongoDB:

We can choose to install the latest version of the MongoDB server and related tools.

$ sudo apt install mongodb-org

If we need to install some specific version of the mongodb due to project requirements, then we should also be able to do it as follows. In our use case we are trying to install version 4.0.4

$ sudo apt install mongodb-org=4.0.4 mongodb-org-server=4.0.4 mongodb-org-shell=4.0.4 mongodb-org-mongos=4.0.4 mongodb-org-tools=4.0.4

Configure MongoDB Service:

Once the installation is complete let’s configure the system to start the MongoDB server process while system startup.

$ sudo systemctl enable mongod
$ sudo systemctl start mongod

Test MongoDB Installation:

To test the MongoDB installation use commands as follows:

$ mongo --version

Output:

MongoDB Installation Output

MongoDB GUI Client:

You can also use Robo3T as MongoDB graphical interface client. This tool provides a nice set of features to have an easy-going MongoDB access.

MongoDB GUI Client