How to install MongoDB Community Server on Linux
MongoDB Community Server is a free, community-driven database with many excellent features. Here’s how to install MongoDB Community Server on your Linux system.
Ubuntu 18.04
To install MongoDB Community Server on Ubuntu 18.04, you must first download the package to the system. Next, open a terminal window, then use the wget command to grab the latest package.
wget https://repo.mongodb.org/apt/ubuntu/dists/bionic/mongodb-org/5.0/multiverse/binary-amd64/mongodb-org-server_5.0.8_amd64.deb
After downloading the package to your Ubuntu 18.04 system, you’ll be able to install it using the apt install command. Using this command, rather than dpkg, will collect all dependencies at installation time.
sudo apt install ./mongodb-org-server_5.0.8_amd64.deb
ARM
Not everyone uses x86 Ubuntu 18.04. Thankfully, MongoDB Community Server is available on ARM. Use the wget download command to grab the latest ARM package to install it.
wget https://repo.mongodb.org/apt/ubuntu/dists/bionic/mongodb-org/5.0/multiverse/binary-arm64/mongodb-org-server_5.0.8_arm64.deb
Once the 18.04 ARM package is downloaded to your system, you can install it using the apt install command below.
sudo apt install ./mongodb-org-server_5.0.8_arm64.deb
Ubuntu 20.04
If you’re running Ubuntu 20.04 on your system and need to get MongoDB Community Server working, open up a terminal window. Then, use the wget download command to grab the latest 20.04 DEB release.
wget https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-org-server_5.0.8_amd64.deb
Once the DEB package is done downloading to your system, you’ll be able to install the software using the apt install command below. This command will collect all dependencies at installation time.
sudo apt install ./mongodb-org-server_5.0.8_amd64.deb
ARM
Those on the ARM release of Ubuntu 20.04 will still be able to install MongoDB Community Server as there is an ARM DEB package available. To get your hands on this release of MongoDB Community Server, run the following wget command.
wget https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-arm64/mongodb-org-server_5.0.8_arm64.deb
The ARM package downloaded is installable on your system using the apt install command.
sudo apt install ./mongodb-org-server_5.0.8_arm64.deb
Debian 10
Those running Debian 10 as a server will be able to set up MongoDB Community Server by installing the latest package release for Debian 10. To get your hands on this package, run the following wget download command.
wget https://repo.mongodb.org/apt/debian/dists/buster/mongodb-org/5.0/main/binary-amd64/mongodb-org-server_5.0.8_amd64.deb
Once the package is downloaded, it can quickly be installed on Debian 10 using the apt-get install command. We’ll use apt-get rather than the Dpkg tool, as it collects dependencies at installation time rather than after the fact.
sudo apt-get install ./mongodb-org-server_5.0.8_amd64.deb
ARM
While it isn’t listed on the MongoDB download page, you can use the ARM version on Debian 10. So, if you plan on setting up MongoDB Community Server on your system, you may be able to use Ubuntu 18.04’s ARM package.
wget https://repo.mongodb.org/apt/ubuntu/dists/bionic/mongodb-org/5.0/multiverse/binary-arm64/mongodb-org-server_5.0.8_arm64.deb
Please note that this package is intended for Ubuntu and not Debian. So, if you run into issues, consider using Ubuntu ARM instead for MongoDB Community Server.
Debian 11
Debian 11 is supported by MongoDB Community Server. If you wish to install it on your system, you’ll need to open up a terminal. Once the terminal window is open, use the wget download command to grab the latest Debian 11 DEB package.
wget https://repo.mongodb.org/apt/debian/dists/bullseye/mongodb-org/5.0/main/binary-amd64/mongodb-org-server_5.0.8_amd64.deb
With the DEB package downloaded to your Debian 11 system, you’ll be able to install it (along with all dependencies) using the apt-get install command.
sudo apt-get install ./mongodb-org-server_5.0.8_amd64.deb
ARM
There is not an official ARM release for Debian 11. However, you can try to run the Ubuntu 20.04 LTS ARM version. However, be warned: it may not work very well.
To get your hands on the Ubuntu 20.04 ARM package, run the following wget command.
wget https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-arm64/mongodb-org-server_5.0.8_arm64.deb
After downloading the package to your system, you can install it using the apt-get install command.
sudo apt-get install ./mongodb-org-server_5.0.8_arm64.deb
RedHat Enterprise Linux/CentOS 7
If you’re on RHEL 7/CentOS 7, you’ll be able to get MongoDB Community Server up and running with a downloadable RPM package file from the official website. Open up a terminal window and run the following wget download command to download the latest release.
wget https://repo.mongodb.org/yum/redhat/7/mongodb-org/5.0/x86_64/RPMS/mongodb-org-server-5.0.8-1.el7.x86_64.rpm
After downloading the RPM package to your system, you can install it using the rpm command.
sudo rpm –ivh mongodb-org-server-5.0.8-1.el7.x86_64.rpm
Alternatively, you can do a yum localinstall.
sudo yum localinstall mongodb-org-server-5.0.8-1.el7.x86_64.rpm
RedHat Enterprise Linux/CentOS 8
Those using RHEL 8/CentOS 8 can set up the MongoDB Community Server by downloading the RPM package from the official website. To grab the latest MongoDB Community Server package, run the following wget command.
wget https://repo.mongodb.org/yum/redhat/8/mongodb-org/5.0/x86_64/RPMS/mongodb-org-server-5.0.8-1.el8.x86_64.rpm
Once the RPM package is downloaded, you’ll be able to install it using the rpm command.
sudo rpm -ivh mongodb-org-server-5.0.8-1.el8.x86_64.rpm
Or, if you prefer, it is possible to install the software using a yum localinstall.
sudo yum localinstall mongodb-org-server-5.0.8-1.el8.x86_64.rpm
ARM
There is an ARM variant for RHEL 8/CentOS 8.2. Start downloading the RPM package to the system using the wget download command if you wish to install it.
wget https://repo.mongodb.org/yum/redhat/8/mongodb-org/5.0/aarch64/RPMS/mongodb-org-server-5.0.8-1.el8.aarch64.rpm
With the package downloaded to your system, use the rpm command to install the software.
sudo rpm -ivh mongodb-org-server-5.0.8-1.el8.aarch64.rpm
Or, use the yum localinstall command to set up the package instead.
sudo yum localinstall mongodb-org-server-5.0.8-1.el8.aarch64.rpm
OpenSUSE 12
MongoDB Community Server is available for OpenSUSE 12. If you run it on your server and need to install MongoDB Community Server, you’ll need to download the latest RPM package via wget.
wget https://repo.mongodb.org/zypper/suse/12/mongodb-org/5.0/x86_64/RPMS/mongodb-org-server-5.0.8-1.suse12.x86_64.rpm
After downloading the latest MongoDB Community Server RPM package, run the following zypper install command to set up the package.
sudo zypper install mongodb-org-server-5.0.8-1.suse12.x86_64.rpm
OpenSUSE 15
OpenSUSE 15 is supported by MongoDB Community Server. You’ll have to download the package to the OpenSUSE 15 system to install it. So, using the wget download command.
wget https://repo.mongodb.org/zypper/suse/15/mongodb-org/5.0/x86_64/RPMS/mongodb-org-server-5.0.8-1.suse15.x86_64.rpm
With the package done downloading, you’ll be able to install it using the zypper install command below.
sudo zypper install mongodb-org-server-5.0.8-1.suse15.x86_64.rpm