Home How to install MongoDB 4.4 on 22.04
Post
Cancel

How to install MongoDB 4.4 on 22.04

Introduction

MongoDB 4.4 is still required by some software even though it is now deprecated. With Ubuntu 20.04 going into the end of life in the near future, upgrading to the newer version of Ubuntu is becoming important for the security of your server in the future. However, MongoDB 4.4 does not support Ubuntu 22.04 natively. Fortunately, a workaround is possible, allowing you to run MongoDB 4.4 on your server.

Prerequisites

Before beginning make sure to have these things completed:

  • Installation of Ubuntu 22.04 server.
  • A user with sudo access.
  • Up to date package list.

This can be achieved using:

1
sudo apt update

Installation

Begin by installing by Libssl 1.1 which is needed by MongoDB without it your will get an error.

As there is no install candidate on Ubuntu 22.04, we need to add the package to the package list.

This list from Ubuntu 20.04 contains the package we need.

1
echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list

Next, we will need to update the package manager to include this package:

1
sudo apt update

Now install the package:

1
sudo apt-get install libssl1.1

After the installation has completed, remove the package list as it is no longer necessary.

1
sudo rm /etc/apt/sources.list.d/focal-security.list

Now that the dependancy is installed, begin installing MongoDB 4.4.

First we need add another package list to the package manager in order to download Version 4.4 of MongoDB.

Add the MongoDB key:

1
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
1
2
3
4
Output:

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK

Add the package list:

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

Update the package manager to incorparate the list:

1
sudo apt-get update

Now install MongoDB 4.4:

1
sudo apt-get install mongodb-org -y

Verify the installation alongside version:

1
mongod --version
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Output:

db version v4.4.23
Build Info: {
    "version": "4.4.23",
    "gitVersion": "36c047f935fd86b2d5ac4c4f5189e52daa044966",
    "openSSLVersion": "OpenSSL 1.1.1f  31 Mar 2020",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "ubuntu2004",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

Finally, start the service:

1
2
3
sudo systemctl start mongod
sudo systemctl enable mongod
sudo systemctl status mongod

The output should look as follows

1
2
3
4
5
6
7
8
9
10
11
12
Output:

mongod.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2023-08-03 11:11:16 UTC; 28s ago
       Docs: https://docs.mongodb.org/manual
   Main PID: 3580 (mongod)
     Memory: 60.5M
        CPU: 1.180s
     CGroup: /system.slice/mongod.service
             └─3580 /usr/bin/mongod --config /etc/mongod.conf

Conclusion

With the successful installation of MongoDB 4.4 on Ubuntu 22.04, your be able to run software that has not updated to the latest version of MongoDB.

If you were following this guide in order to install Omada SDN on Ubuntu 22.04, use this link to get back to that guide.

This post is licensed under CC BY 4.0 by the author.
Contents

How to install Omada Software Controller V5 on Ubuntu 20.04

How to install Omada Software Controller V5 on Ubuntu 22.04