Install Mongodb on Ubuntu 20.04

MongoDB Ubuntu

Install MongoDB on Ubuntu 20.04 by following these steps.

Import the MongoDB Public GPG Key: Open a terminal and run the following command to import the MongoDB public GPG key:

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

Add the MongoDB Repository: Next, you'll add the MongoDB repository to your system:

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list

Then, update the package lists:

sudo apt update

Install MongoDB: Now you can install MongoDB with the following command:

sudo apt install -y mongodb-org

This command installs the MongoDB packages and dependencies.

Start and Enable MongoDB Service: After the installation is complete, start the MongoDB service and enable it to start on boot

sudo systemctl start mongod
sudo systemctl enable mongod

Verify Installation: You can verify that MongoDB is running by checking its status:

sudo systemctl status mongod

You should see an output indicating that the service is active and running.

Access MongoDB: MongoDB is now installed and running. You can access the MongoDB shell by running:

mongo

This will open the MongoDB shell where you can start interacting with the database.

Comments
Loading...
Sorry! No comment found:(

There is no comment to show for this.

Leave your comment