Friday , April 26 2024

How To Install MongoDb on Ubuntu

The main purpose of this article is how to install MongoDB on Ubuntu Server(single node). Follow the steps below for the installation one by one.

Step1:

Install Mongodb Packages on Ubuntu

Ubuntu’s official package repositories contain an updated version of MongoDB; which means we can install the required packages using apt.

First, update the package list to have the latest version of the repository lists:

Now install the MongoDB package.

This command installs several packages containing the latest version of MongoDB, as well as useful management tools for the MongoDB server. The database server is started automatically after installation.

Next, let’s verify that the server is working correctly.

Step 2:

Checking mongodb Service and Database on Ubuntu

The installation process started MongoDB automatically, but let’s verify that the service is started and the database is running.

Check mongodb status on ubuntu

You will see this output:
MongoDB server is running.

We can really verify this by connecting to the database server and executing a diagnostic command.

Execute this command:

Command Output:

Step 3:

Managing MongoDB Service

MongoDB is installed as a system service, so you can also manage it using standard system commands.

Check Mongodb Service Status

Stop Mongodb Service

Start Mongodb Service

Restart Mongodb Service

By default, MongoDB is configured to start automatically with the server. If you want to disable auto start, type:
It is very easy to re-enable. To do this, use:

Connect to Mongodb

After our installations are completed successfully, we provide Connection with mongo command.

List Mongodb Databases

Show Connected Mongodb Database Name

Switch To Another Database

List Mongodb Commands

Check MongoDB Statistics

Good luck with.

Loading

About Yusuf KAHVECİ

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories