Menu

How to Install MongoDB 4.4 on Ubuntu 18.04 (Legacy Guide)

Legacy guide for MongoDB 4.4 on Ubuntu 18.04 Bionic. MongoDB 4.4 is EOL and Ubuntu standard support ended; use MongoDB 8.0 on Ubuntu 24.04.

Posted on By Updated on
On this page

Support status: Ubuntu 18.04 Bionic standard support ended on May 31, 2023, and MongoDB 4.4 reached end of life on February 29, 2024. Ubuntu Pro ESM may cover the operating system through 2028, but does not restore MongoDB 4.4 support. Keep these steps only for an existing legacy host. For a supported combination, see our MongoDB 8.0 guide for Ubuntu 24.04. See Ubuntu 18.04 lifecycle information and MongoDB’s lifecycle schedule.

Prerequisites

Before you begin the MongoDB installation, ensure that you have the following:

  • A system running Ubuntu 18.
  • A user account with sudo privileges.
  • An internet connection to download the MongoDB package.

Step 1: Update System Packages

The first step is to make sure your system’s package list is up to date. Open a terminal and run the following command:

sudo apt update

This command will refresh the list of available packages and their versions.

Step 2: Install MongoDB

To install MongoDB on Ubuntu 18, you can use the official MongoDB repository. Follow these steps:

2.1 Add MongoDB Repository

Add the MongoDB repository to your system using the wget command:

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

2.2 Create MongoDB Repository File

Create a MongoDB repository file for Ubuntu 18:

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

2.3 Install MongoDB

Now, you can install MongoDB by running the following commands:

sudo apt update
sudo apt install -y mongodb-org

This will install the MongoDB server and related packages.

Step 3: Start and Enable MongoDB

After the installation is complete, you need to start the MongoDB service and enable it to start on boot:

3.1 Start MongoDB

Start the MongoDB service using the following command:

sudo systemctl start mongod

3.2 Enable MongoDB on Boot

To ensure MongoDB starts automatically when the system boots, run this command:

sudo systemctl enable mongod

Step 4: Verify MongoDB Installation

To verify that MongoDB has been successfully installed and is running, you can check its status:

sudo systemctl status mongod

If MongoDB is running correctly, you’ll see the status as “active (running).”

Step 5: Access the MongoDB Shell

You can access the MongoDB shell to interact with the database. Simply open a terminal and run:

mongo

This will open the MongoDB shell, and you can start working with your MongoDB instance.

Conclusion

You’ve successfully installed MongoDB on your Ubuntu 18 system. MongoDB is a versatile and scalable NoSQL database that can power your applications. You can now create databases, collections, and documents and use MongoDB for your projects. If you encounter any issues or want to learn more about MongoDB, refer to the official MongoDB documentation for detailed information. Enjoy using MongoDB on your Ubuntu 18 system!