MongoDB is a very popular NoSQL database that can be used with both Linux and Windows operating systems. This database is specially designed to be cross-platform and it is highly document-oriented. The documents of MongoDB follow the JSON structure and also offer optional schemas. Basically, the data in this database is stored in the form of documents. In this article, we aim to demonstrate to you the complete procedure of installing MongoDB on Linux.
Note: We have used Linux Mint 20 to demonstrate the process of installation.
Method of Installing MongoDB on Linux:
For having MongoDB installed on your Linux Mint 20 system, you are required to perform all the steps shown below:
Step # 1: Updating Linux Mint 20 System Cache:
For updating your Linux Mint 20 system cache, you should first launch the terminal by clicking on its icon. The terminal of Linux Mint 20 is shown in the following image:
After launching your terminal, run the command stated below in it:
sudo apt update
When your system cache has been successfully updated, your Linux Mint 20 system will cause the terminal to display the following output on it:
Step # 2: Installing MongoDB on Linux Mint 20:
After updating our system, we are all set to install on it by running the command stated below in our terminal:
sudo apt install mongodb
During the execution of this command, as soon as you will be asked to provide confirmation for this action, you need to press “Y” for carrying on smoothly with your installation as highlighted in the following image:
Once MongoDB has been successfully installed on your Linux Mint 20 system, your system will cause the terminal to display the output shown in the image below:
Step # 3: Checking the Status of MongoDB:
Now we need to check whether the installation on Linux Mint 20 has also caused it to start automatically or not. This can be checked by running the following command in our terminal:
sudo systemctl status mongodb
When you will run this command, the status will appear on your terminal which is also highlighted in the image shown below. With this, you can verify that the MongoDB service is active and running.
Step # 4: Accessing MongoDB in Linux Mint 20:
After verifying that the MongoDB service is active and running, we can easily access it by running the following command in our terminal:
Running this command will display the MongoDB shell on your terminal if it has been successfully installed on your Linux Mint 20 system as shown in the image below:
By following all the steps listed in this article, one can easily have MongoDB installed on his Linux Mint 20 system, can check its status, and can also access its shell to pass commands to this database. The process described in this article is extremely simple to follow. Moreover, all the commands in it get executed successfully just within a few minutes.