MongoDB

How to install MongoDB on Ubuntu 20.04

How to install MongoDB on Ubuntu 20.04
MongoDB is one of the most popular NoSQL databases, it is open source and freely available to download. It stores data in the form of flexible documents like JSON rather than the usual table style method found in SQL databases. MongoDB is used to store and work on data without the use of schema or ordering patterns. The MongoDB NoSQL database is widely used in web applications because it has easier integration with various programming languages.

In this tutorial guide, I will show you how to install, run, and uninstall MongoDB on ubuntu 20.04.

Install MongoDB NoSQL Database:

MongoDB is very easy to install, and it is present in Ubuntu 20.04 software repository.

Step 1:

As always, first, update and upgrade your APT.

$ sudo apt update

$ sudo apt upgrade

Step 2:

Now download and install it via the following terminal command. It requires root privileges so type sudo with command.

$ sudo apt install mongodb

Step 3:

MongoDB is installed on your system now and it starts automatically after installation. To check the status of this database, type the following command in the terminal window.

$ sudo systemctl status mongodb

Run MongoDB service:

MongoDB service needs the systemctl command to modify its state. It requires root privileges so sudo must be used before every command.

MongoDB status checking:

The following command is used to check the status.

$ sudo systemctl status mongodb

MongoDB starts command:

MongoDB can be started through the following command.

$ sudo systemctl start mongodb

MongoDB stop command:

MongoDB can be stopped with this command.

$ sudo systemctl stop mongodb

MongoDB restart command:

In case you run into some errors and restart is compulsory then type the following command.

$ sudo systemctl restart mongodb

Enable option MongoDB when the system boots:

$ sudo systemctl enable mongodb

Disable option for MongoDB when the system boots:

$ sudo systemctl disable mongodb

By default, MongoDB is enabled after installation.

Starting MongoDB shell:

To work on the databases, you can open the “mongo shell” with the following terminal command.

$ sudo mongo

Uninstall MongoDB:

In case you do not need MongoDB and want to uninstall it then enter these three commands.

$ sudo systemctl stop mongodb

This command will stop the service.

$ sudo apt purge mongodb

$ sudo apt autoremove

These two commands will uninstall the MongoDB database. This will wipe out all the database files so make sure that you have backed up your necessary files.

Conclusion:

Wasn't this an easy tutorial for installing MongoDB on ubuntu? MongoDB is a popular database for creating NoSQL documents.

5 najlepszych ergonomicznych myszy komputerowych dla systemu Linux
Czy długotrwałe korzystanie z komputera powoduje ból nadgarstka lub palców?? Cierpisz na sztywne stawy i ciągle musisz uścisnąć dłonie? Czy czujesz pa...
Jak zmienić ustawienia myszy i touchpada za pomocą Xinput w systemie Linux?
Większość dystrybucji Linuksa jest domyślnie dostarczana z biblioteką „libinput” do obsługi zdarzeń wejściowych w systemie. Może przetwarzać zdarzenia...
Remap your mouse buttons differently for different software with X-Mouse Button Control
Maybe you need a tool that could make your mouse's control change with every application that you use. If this is the case, you can try out an applica...