In today’s article we discuss on the installation and configuration of UniFi Controller on Ubuntu 20.04 (Focal Fossa) Linux system. The UniFi Controller software is commonly referred to as UniFi Network Server in UniFi terminologies. As a Network Engineer with an experience in systems management, self-hosting a UniFi Network Server can be ideal way of cutting on the cost of hardware. It is applicable for small setup and home labs. But for corporate setup we recommend you purchase an appliance such as the UniFi Cloud Gateway Max, which runs the Network application and the router on one box with a 512 GB SSD for Protect, or the UniFi Express 7 and Dream Router 7 if you also want WiFi 7 built in. Those two have no new US unit in stock on Amazon right now, so they are easiest to buy direct from Ubiquiti.
The UniFi Network Application (formerly UniFi Controller), is a software developed by Ubiquiti Networks to provide the capability to manage multiple UniFI networks devices from a web browser. The software can be installed on Windows, macOS and Linux system. In our previous article we provided below articles.
Before you install UniFi Network Application, ensure the following requirements are met;
- A DHCP-enabled network
- Java Runtime Environment
- Linux, Mac OS X, or Microsoft Windows 7/8 – Running controller software.
- Web Browser: Mozilla Firefox, Google Chrome, or Microsoft Internet Explorer 8 (or above)
Before running the software controller, you will need UniFi hardware to adopt. The UniFi U7 Lite access point is a cost-effective starting point: dual-band WiFi 7 with a 2.5GbE uplink, and the successor to the U6 Lite. Pair it with the UniFi Switch Ultra 60W to handle both switching and PoE+ delivery (on seven of its eight ports) from one unit. The access point and the switch both ship from third-party sellers on Amazon, so check that each listing is the US version.
Software versions requirements:
- Java 11 / Java 8
- MongoDB <=4.0, but >=3.6 (We’ll install MongoDB 4.0)
Before we begin the installation, confirm your OS details:
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
Let’s update and upgrade the system before we proceed further.
sudo apt update && sudo apt -y full-upgrade
A reboot is recommended if required.
[ -f /var/run/reboot-required ] && sudo reboot
The [ -f ... ] test makes the command reboot only when the upgrade left the reboot-required flag behind.
1 – Add UniFi and MongoDB APT repositories
Before we add the repositories let’s install required dependencies.
sudo apt install curl gpg gnupg2 software-properties-common apt-transport-https lsb-release ca-certificates
With these packages in place, apt can fetch repository signing keys over HTTPS.
Add MongoDB APT repository
Start by adding GPG key to your system keyring. As stated earlier we are installing MongoDB Server 4.0.
curl -fsSL https://pgp.mongodb.com/server-4.0.asc | sudo gpg --dearmor -o /usr/share/keyrings/mongodb-server-4.0.gpg
Next add the repository containing MongoDB 4.0 packages. This will be based on Ubuntu Bionic Beaver.
echo "deb https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
Update APT package index.
$ sudo apt update
Hit:1 https://mirror.hetzner.com/ubuntu/packages focal InRelease
Hit:2 https://mirror.hetzner.com/ubuntu/packages focal-updates InRelease
Hit:3 https://mirror.hetzner.com/ubuntu/packages focal-backports InRelease
Hit:4 https://mirror.hetzner.com/ubuntu/security focal-security InRelease
Ign:6 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 InRelease
Hit:5 https://dl.ui.com/unifi/debian stable InRelease
Get:7 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 Release [2,989 B]
Get:8 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 Release.gpg [801 B]
Ign:8 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 Release.gpg
Reading package lists... Done
The MongoDB repository now shows up in the apt update output.
Add UniFi APT repository
Import repository GPG key used in signing UniFi APT packages.
sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg
Add UniFi APT repository by executing commands below in your terminal.
echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/ubnt-unifi.list
That file points apt at Ubiquiti’s stable channel for the unifi package.
2 – Disable Install of Java 17
Restrict Ubuntu system from automatically installing Java 17.
sudo apt-mark hold openjdk-17-*
UniFi installation will pull Java 11 as default.
3 – Install UniFi Network Application on Ubuntu 20.04
Now that we’ve added UniFi and MongoDB repository, let’s begin the installation of UniFi Network Application (UniFi Controller) on Ubuntu 20.04.
sudo apt install unifi
Accept installation prompt as requested.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu ca-certificates-java fontconfig-config fonts-dejavu-core java-common libavahi-client3 libavahi-common-data libavahi-common3 libbinutils
libboost-filesystem1.71.0 libboost-iostreams1.71.0 libboost-program-options1.71.0 libctf-nobfd0 libctf0 libcups2 libfontconfig1 libgoogle-perftools4 libgraphite2-3 libharfbuzz0b libjpeg-turbo8
libjpeg8 liblcms2-2 libpcrecpp0v5 libpcsclite1 libsnappy1v5 libtcmalloc-minimal4 libyaml-cpp0.6 mongo-tools mongodb-clients mongodb-server mongodb-server-core openjdk-11-jre-headless
Suggested packages:
binutils-doc default-jre cups-common liblcms2-utils pcscd libnss-mdns fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei | fonts-wqy-zenhei fonts-indic
The following NEW packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu ca-certificates-java fontconfig-config fonts-dejavu-core java-common libavahi-client3 libavahi-common-data libavahi-common3 libbinutils
libboost-filesystem1.71.0 libboost-iostreams1.71.0 libboost-program-options1.71.0 libctf-nobfd0 libctf0 libcups2 libfontconfig1 libgoogle-perftools4 libgraphite2-3 libharfbuzz0b libjpeg-turbo8
libjpeg8 liblcms2-2 libpcrecpp0v5 libpcsclite1 libsnappy1v5 libtcmalloc-minimal4 libyaml-cpp0.6 mongo-tools mongodb-clients mongodb-server mongodb-server-core openjdk-11-jre-headless unifi
0 upgraded, 35 newly installed, 0 to remove and 0 not upgraded.
Need to get 244 MB of archives.
After this operation, 678 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Answer y and apt installs the unifi package together with MongoDB and OpenJDK 11, as the package list above shows.
Manually installing UniFi Network Application on Ubuntu 20.04
If you prefer manual installation method, download a .deb package by visiting download the UniFi Controller software from the Ubiquiti Networks website.
Choose latest available release for Linux and Click on Download.

Choose a directory where to save the file.

If downloading the file with wget, use syntax:
wget https://dl.ui.com/unifi/<VERSION>/unifi_sysvinit_all.deb
Installation of .deb package can be done with apt while passing dowloaded file path as an argument.
$ sudo apt install ./unifi_sysvinit_all.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'unifi' instead of './unifi_sysvinit_all.deb'
The following additional packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu ca-certificates-java fontconfig-config fonts-dejavu-core java-common jsvc libasound2 libasound2-data libavahi-client3 libavahi-common-data
libavahi-common3 libbinutils libboost-filesystem1.65.1 libboost-iostreams1.65.1 libboost-program-options1.65.1 libboost-system1.65.1 libcommons-daemon-java libcups2 libfontconfig1
libgoogle-perftools4 libgraphite2-3 libharfbuzz0b libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3 libpcrecpp0v5 libpcsclite1 libsnappy1v5 libstemmer0d libtcmalloc-minimal4 libyaml-cpp0.5v5
mongo-tools mongodb-clients mongodb-server mongodb-server-core openjdk-17-jre-headless
Suggested packages:
binutils-doc default-jre libasound2-plugins alsa-utils java-virtual-machine cups-common liblcms2-utils pcscd libnss-mdns fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho
fonts-wqy-microhei | fonts-wqy-zenhei fonts-indic
The following NEW packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu ca-certificates-java fontconfig-config fonts-dejavu-core java-common jsvc libasound2 libasound2-data libavahi-client3 libavahi-common-data
libavahi-common3 libbinutils libboost-filesystem1.65.1 libboost-iostreams1.65.1 libboost-program-options1.65.1 libboost-system1.65.1 libcommons-daemon-java libcups2 libfontconfig1
libgoogle-perftools4 libgraphite2-3 libharfbuzz0b libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3 libpcrecpp0v5 libpcsclite1 libsnappy1v5 libstemmer0d libtcmalloc-minimal4 libyaml-cpp0.5v5
mongo-tools mongodb-clients mongodb-server mongodb-server-core openjdk-17-jre-headless unifi
0 upgraded, 41 newly installed, 0 to remove and 57 not upgraded.
Need to get 280 MB of archives.
After this operation, 724 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
A successful installation should have an output similar to below.
Note, selecting 'unifi' instead of './unifi_sysvinit_all.deb'
unifi is already the newest version (7.4.162-1).
0 upgraded, 0 newly installed, 0 to remove and 57 not upgraded.
The version line confirms which UniFi Network Application release the package installed.
4 – Create account on UniFi cloud
If you don’t have an existing UniFi Cloud account, create one on unifi.ui.com. Login or click on “Create one“

Input your details to create new account. Once done a confirmation email will be send to your email address provided at time of creating account.

Verify an email to activate UniFi account.

With the account active, switch back to the server and start the application.
5 – Access UniFi Network Application on Browser
Restart unifi service using systemctl.
sudo systemctl restart unifi.service
Check to confirm if the service is status.
$ systemctl status unifi.service
● unifi.service - unifi
Loaded: loaded (/lib/systemd/system/unifi.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2023-08-28 09:50:20 UTC; 51s ago
Process: 11195 ExecStartPre=/usr/sbin/unifi-network-service-helper init (code=exited, status=0/SUCCESS)
Process: 11254 ExecStartPre=/usr/sbin/unifi-network-service-helper init-uos (code=exited, status=0/SUCCESS)
Process: 11264 ExecStartPost=/usr/sbin/unifi-network-service-helper healthcheck (code=exited, status=0/SUCCESS)
Main PID: 11263 (java)
Tasks: 88 (limit: 4541)
Memory: 772.7M
CGroup: /system.slice/unifi.service
├─11263 /usr/bin/java -Dfile.encoding=UTF-8 -Djava.awt.headless=true -Dapple.awt.UIElement=true -Dunifi.core.enabled=false -Dunifi.mongodb.service.enabled=false -Xmx1024M -XX:+UseParal>
└─11323 bin/mongod --dbpath /usr/lib/unifi/data/db --port 27117 --unixSocketPrefix /usr/lib/unifi/run --logRotate reopen --logappend --logpath /usr/lib/unifi/logs/mongod.log --pidfilep>
Aug 28 09:49:50 focal unifi[11253]: init complete...
Aug 28 09:49:50 focal unifi-network-service-helper[11253]: <13>Aug 28 09:49:50 unifi: init complete...
Aug 28 09:49:50 focal unifi[11273]: health-check max retry count: 100
Aug 28 09:49:50 focal unifi-network-service-helper[11273]: <13>Aug 28 09:49:50 unifi: health-check max retry count: 100
Aug 28 09:50:20 focal systemd[1]: Started unifi.
Services should be available on port 8080 and port 8443.
jmutai@unifi-controller:~$ ss -tunelp | egrep '8080|8443'
tcp LISTEN 0 100 *:8443 *:* uid:112 ino:47897 sk:a v6only:0 <->
tcp LISTEN 0 100 *:8080 *:* uid:112 ino:47891 sk:e v6only:0 <->
UniFi Network Application main log files
- /usr/lib/unifi/logs/server.log
- /usr/lib/unifi/logs/mongod.log
Access UniFi Network Application on a web browser using the server IP address an port 8443.
https://172.20.30.20:8443/
You’ll get SSL warnings while trying to access the portal. Ignore and proceed to setup.
Provide a name for your Network application.

Sign in with the Ubiquiti account you created earlier.

Consider enabling automatic backup of your network configurations.

For Ubiquiti devices on the same network as the controller, they’ll be discovered automatically. Choose the once you’ll like to configure.

Define your first WiFi network if this is a new configuration of UniFi network.

When done review your configurations to complete the installation.

Installation should finalize in few seconds.

You’ll be presented with an intuitive interface where most actions can be performed.

New devices on the same network segment can be adopted from this dashboard. If they sit on another subnet or are still managed by an old controller, point them here first, as the next section shows.
Pointing UniFi Devices to existing UniFi Controller
If you new installation is intended to replace an old Controller, login to UniFi devices and set inform address to the new server address and port. See example below.
set-inform http://172.20.30.20:8080/inform
Give it sometime and status should reflect the recent update we populated.
US-16-150W-US.6.2.14# info
Model: US-16-150W
Version: 6.2.14.13855
MAC Address: 98:8a:20:fd:ea:94
IP Address: 192.168.1.116
Hostname: US-16-150W
Uptime: 992330 seconds
Status: Connected (http://172.20.30.20:8080/inform)
Visit UniFi documentation pages to learn more about using the software to manage your network devices. In future we’ll do more articles that cover Ubiquiti UniFi devices.