How to Install MongoDB 7.0 and UniFi Network Server on Debian 12 "Bookworm"
Updated On: Dec. 05, 2024 Author: Kevin

How to Install MongoDB 7.0 and UniFi Network Server on Debian 12 "Bookworm"

MongoDB is a powerful and widely-used NoSQL database, renowned for its flexibility, scalability, and robust performance. With the release of MongoDB 8.0, stricter hardware requirements have been introduced, including mandatory support for the SSE4.2 CPU instruction set. However, the UniFi Network Application does not yet support MongoDB 8.0, making MongoDB 7.0 the recommended choice to ensure compatibility and stability for UniFi installations.

 

This guide will walk you through the process of installing MongoDB 7.0 and UniFi on Debian 12 "Bookworm." If you're hosting UniFi on a virtual machine, make sure to pass the correct CPU architecture and features to the VM to meet MongoDB's requirements (note that this is not covered in this article).

 

Step 1: Update and Prepare the System

Before installing MongoDB or UniFi, update your system and install essential packages:

sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget gnupg apt-transport-https ca-certificates

Step 2: Add the UniFi Repository

Add the official UniFi repository to your system:

echo 'deb [ arch=amd64 ] https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg
sudo apt update

Step 3: Add the MongoDB 7.0 Repository

Add the MongoDB 7.0 repository to your system:

wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
sudo apt update

Step 4: Install MongoDB 7.0

Install MongoDB 7.0 using the following command:

sudo apt install -y mongodb-org

Step 5: Start and Enable MongoDB

Start the MongoDB service and enable it to start on boot:

sudo systemctl start mongod
sudo systemctl enable mongod

Check the service status to ensure it is running:

sudo systemctl status mongod

Step 6: Install UniFi

Install the UniFi Network Application:

sudo apt install -y unifi

Step 7: Verify the Installation

After installation, verify that both MongoDB and UniFi are running:

sudo systemctl status mongod
sudo systemctl status unifi

Step 8: Access UniFi

Once the UniFi Network Application is running, open your browser and navigate to:

https://<your-server-ip>:8443

Follow the setup wizard to configure your UniFi controller.

Conclusion

This guide ensures that you have a stable installation of MongoDB 7.0 and the UniFi Network Application on Debian 12 "Bookworm." MongoDB 7.0 is a great choice for UniFi as it maintains compatibility with the application while leveraging newer database features supported by Debian 12. Remember, your CPU must support SSE4.2 for MongoDB 7.0 to function. If you encounter issues, check the logs:

sudo journalctl -u mongod
sudo journalctl -u unifi

Happy networking!