MongoDB, Inc continuously putting their effort in order to make this no-SQL database more awesome. Recently they have released version 4.2 with extreme performance optimizations along with few cool features e.g. Rollback Time limit, Retryable Writes, Kill Own Cursors, etc.

Today we will try to install MongoDB 4.2.x on Ubuntu 18.04 LTS x86_64 (64 bit) Operating system.

Configure APT repository:

$ sudo apt-get install gnupg

$ wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add - 

$ echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org.list

$ sudo apt update

We can choose to install the latest version of the MongoDB server and all related tools by default as follows:

$ sudo apt install mongodb-org

If you need to install a specific version of the MongoDB for project dependencies, then you should also be able to do it as well. In our use case, we are trying to install version 4.2.1

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

Configure MongoDB Service:

With the above steps you should already have the MongoDB installed into your system, so let’s configure it to start on system boot.

$ sudo systemctl enable mongod
$ sudo systemctl start mongod

Test MongoDB Installation:

$ mongo --version

MongoDB GUI Client:

Robo3T is a very popular GUI client for MongoDB, so you may use Robo3T as MongoDB graphical interface client. This tool provides a rich set of features to have an easy-going MongoDB access.

MongoDB GUI Client