[Unifi] Install Unifi Controller on Debian 11 “Bullseye”

I was running my Unifi Controller on an older Debian version, which was frankly already outdated, but also only assigned 1GB of RAM + 15 GB of storage. Adding more RAM and storage would be easy enough but I figured I might as well fire up a new Debian 11 VM from a template I had already made. When I got to install the Unifi Controller software, I was however hit with the errors such as the following:

user@balderII:/downloads# dpkg -i unifi_sysvinit_all.deb
(Reading database ... 74874 files and directories currently installed.)
Preparing to unpack unifi_sysvinit_all.deb ...
Unpacking unifi (7.3.76-19582-1) over (7.3.76-19582-1) ...
dpkg: dependency problems prevent configuration of unifi:
 unifi depends on mongodb-server (>= 2.4.10) | mongodb-10gen (>= 2.4.14) | mongodb-org-server (>= 2.6.0); however:
  Package mongodb-server is not installed.
  Package mongodb-10gen is not installed.
  Package mongodb-org-server is not installed.
 unifi depends on mongodb-server (<< 1:4.0.0) | mongodb-10gen (<< 4.0.0) | mongodb-org-server (<< 4.0.0); however:
  Package mongodb-server is not installed.
  Package mongodb-10gen is not installed.
  Package mongodb-org-server is not installed.

dpkg: error processing package unifi (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 unifi

Attempting to install different version of other people’s homebrewed Unifi packages (which didn’t work for me). I finally realized the simplest solution of all.

If you like me couldn’t install mongodb on your machine for Debian 10 or Debian 11, shoot the following command:

apt-get install gnupg2
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo 'deb [arch=amd64] https://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main' > /etc/apt/sources.list.d/mongodb.list

Follow up with an apt update, and then install mongodb.

apt-get update
apt install mongodb-org-server

Then download the unifi_sysvinit_all.deb package from Unifi. At this moment the, the following droid is the one we’re looking for:

Direct Link: https://www.ui.com/download/unifi/default/default/unifi-network-application-7376-debianubuntu-linux-and-unifi-os-consoles

I copy the download URL and download it to a tmp folder (newest version right now is 7.3.76):

cd /tmp
wget https://dl.ui.com/unifi/7.3.76/unifi_sysvinit_all.deb

We will now create a folder in which we will unpack the .deb-file. In the unpacked files we will remove the steps in which the script(control) checks the mongodb version, so it will no longer complain. – still inside the /tmp folder:

mkdir unpacked
dpkg-deb -R unifi_sysvinit_all.deb unpacked/
vi unpacked/DEBIAN/control

The contents of the file we have opened – and the two lines we need to remove:

Package: unifi
Version: 7.3.76-19582-1
Section: java
Priority: optional
Architecture: all
Depends: binutils, coreutils, adduser, libcap2, curl,
 mongodb-server (>= 2.4.10) | mongodb-10gen (>= 2.4.14) | mongodb-org-server (>= 2.6.0),
 mongodb-server (<< 1:4.0.0) | mongodb-10gen (<< 4.0.0) | mongodb-org-server (<< 4.0.0),
 openjdk-11-jre-headless, logrotate
Pre-Depends: debconf (>= 0.5) | debconf-2.0
Conflicts: unifi-controller
Provides: unifi-controller
Replaces: unifi-controller
Installed-Size: 262719
Maintainer: UniFi developers <unifi-dev@ubnt.com>
Description: Ubiquiti UniFi server
 Ubiquiti UniFi server is a centralized management system for UniFi suite of devices.
 After the UniFi server is installed, the UniFi Network application can be accessed on any
 web browser. The UniFi Network application allows the operator to instantly provision thousands
 of UniFi devices, map out network topology, quickly manage system traffic, and further
 provision individual UniFi devices.
Homepage: http://www.ubnt.com/unifi

Remove the two lines with mongodb-server entirely – save the file.

From this:To this:

Now we need to re-pack the .deb-file, and then install, back in /tmp:

dpkg-deb -b unpacked good-boy-unifi.deb
dpkg -i good-boy-unifi.deb

After this, the Unifi controller worked flawlessly. – I opened a browser and connected to https://{IP}:8443 – uploaded by backup config file, and migrated from the old server to the new server.

Related Posts

Leave a Reply

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