Installing the UniFi Controller on Ubuntu
This tutorial will show you how to install the Unifi controller to the Ubuntu operating system.
Ubiquiti offers an affordable lineup of robust mesh wireless access points, switches, cameras, and plenty more. Of all the products Ubiquiti offers, their network devices are one of the most popular.
To control all of the network devices and maintain an effective mesh network, they need something to control them. The software that manages all of this is called the UniFi network controller.
One of the best things about Ubiquiti is that they don’t force you to use their hardware to run the controller. Instead, you can install the UniFi network controller to any supported operating system such as Ubuntu.
Please note that you will run the following steps within the Ubuntu terminal. If you run a desktop flavor of Ubuntu, you can open the terminal quickly by pressing CTRL + ALT + T on your keyboard.
Mục Lục
Installing the UniFi Controller on Ubuntu
This section will walk you through preparing your Ubuntu system to install the UniFi controller.
Over the next few steps, we will install the required software and add the official UniFi repository.
1. Before we get started, we will need to update the package list of the Ubuntu system.
The package list is a cache of all packages we can install and where apt can download them.
sudo apt update
2. Our first task is to install some packages we will rely on to add the package repositories we require as well as run the UniFi network controller.
Use the following command to install the “wget
“, “gpg
“, “openjdk-8-jre-headless
“, and “havegd
” packages to Ubuntu.
sudo apt install curl haveged gpg openjdk-8-jre-headless
curl
– We will be using curl to download the GPG keys for both MongoDB and the UniFi controller to Ubuntu.haveged
– This package allows us to generate extra entropy that the UniFi controller needs during startup to help guarantee security.gpg
– We need to ensure this package is installed as we will need to “dearmor
” the MongoDB GPG key before we save it to our system.openjdk-8-jre-headless
– As the UniFi controller is built upon Java we will need to install the java runtime environment. At the time of publishing UniFi still relies on Java 8.
Adding the UniFi Repository to Ubuntu
3. Our first step is to download the UniFi GPG key to our system. This key helps tell the package manager that the packages are valid and have been signed by the repository.
Download this key to your system using the following command within the terminal.
curl https://dl.ui.com/unifi/unifi-repo.gpg | sudo tee /usr/share/keyrings/ubiquiti-archive-keyring.gpg >/dev/null
4. With the UniFi GPG key saved to our Ubuntu device, we can now add the repository to our sources list.
Adding UniFi to the “apt
” sources list is as straightforward as using the following command.
echo 'deb [signed-by=/usr/share/keyrings/ubiquiti-archive-keyring.gpg] https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list > /dev/null
Installing Libssl1.1
5. As the version of MongoDB we need to run the Unifi controller relies on an older version of LibSSL, we will need to install this package manually.
Luckily, LibSSL1.1 is still available through the Ubuntu archive and can be downloaded using the following command.
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb -O libssl1.1.deb
6. With the LibSSL1.1 package downloaded to your Ubuntu device, you can install it by running the following command.
sudo dpkg -i libssl1.1.deb
Adding the MongoDB Repository
7. With the UniFi repository added to our Ubuntu system, we can move on to adding the one for MongoDB 3.6.
Before adding the MongoDB repository, our first step is to download its GPG key using the command below.
curl https://pgp.mongodb.com/server-3.6.asc | sudo gpg --dearmor | sudo tee /usr/share/keyrings/mongodb-org-server-3.6-archive-keyring.gpg >/dev/null
8. Once the GPG key has been added, our next step is to add the MongoDB 3.6 repository to our Ubuntu device.
As the UniFi controller relies on an older version of MongoDB, we can’t just rely on a version provided through the Ubuntu repository.
Use the command below in your terminal to add the MongoDB 3.6 repository to the sources list on your system.
echo 'deb [signed-by=/usr/share/keyrings/mongodb-org-server-3.6-archive-keyring.gpg] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/3.6 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list > /dev/null
Installing MongoDB 3.6 to Ubuntu
9. As we changed our sources list, we will need to perform a package list update.
If we don’t perform an update, the apt package manager won’t be aware of any of our newly added repositories.
sudo apt update
10. We can now install the final piece of software we require to install and run the UniFi controller on Ubuntu.
This final piece of software is called “MongoDB” and is the database server that UniFi requires.
You can install the MongoDB server to Ubuntu by running the command below in the terminal.
sudo apt install -y mongodb-org-server
11. After installing MongoDB, we want to ensure that its service is enabled to start at boot.
Run the command below to ensure that the MongoDB server is set to start at boot.
sudo systemctl enable mongod
12. Finally, we can ensure that the MongoDB server is running by using the following command in the terminal.
This command will start up MongoDB on your Ubuntu device immediately.
sudo systemctl start mongod
Installing the UniFi Network Controller
13. Finally, now that everything is in place, we can install the UniFi controller to Ubuntu by using the following command.
With this command, the apt package manager will download UniFi from the official repository that we added in an earlier step.
sudo apt install unifi
14. At this point, you will finally have the UniFi controller up and running on your Ubuntu device.
Over the next section we will show you how to access this interface and go through the initial setup steps.
Using the UniFi Controller Web Interface
Within this section, we will be showing you how to access your freshly installed UniFi controller’s web interface.
The following steps should work fine in whatever web browser you choose to utilize.
Accessing the Ubuntu UniFi Controller
1. Before we continue, you will need to know the IP address of your Ubuntu device.
One of the easiest ways to get the IP address assigned to the device is to utilize the hostname command as shown below.
hostname -I
2. With the IP address in hand, you will want to go to the following address in your favorite web browser.
Make sure that you replace “IPADDRESS
” with the IP of your device. From this, you can see that the UniFi controller will operate its web interface on port 8443
.
https://IPADDRESS:8443
First Run of the UniFi Controller
3. After heading to the UniFi controller for the first time, you will be greeted by the following screen.
For these first steps, you must assign your Ubuntu UniFi controller a name (1.).
Next, to utilize this controller, you will be required to agree to the Ubiquiti end-user license agreement and their terms of service.
Once you have read through both documents and agree to them, click the checkbox (2.)
Finally, to proceed with the setup steps, you will need to click the “Next
” button (3.).
4. To proceed further you will need to log in to your Ubiquiti account (1.).
If you don’t have an account, you must register for one by going to the official Ubiquiti website.
With your login details entered, click the “Next
” button (2.).
5. You will be asked if you want to configure any basic options for your UniFi Network controller on Ubuntu.
The only option available to us during setup was the “Enable Auto Backup
” option (1.).
When you are happy with your chosen options, click the “Next
” button to proceed (2.).
6. At this point, if you have any Ubiquiti network devices awaiting adoption (1.), you will get the chance to adopt them to your network controller.
Once you are ready, you can proceed through the setup process by clicking the “Next
” button (2.).
7. You can now configure the Wi-Fi network that the UniFi network controller will create on any of your attached network devices.
At this point, you can enter an SSID and password for your network (1.). However, it is possible to skip this process.
In the bottom-right of the page, you will see both the “Skip
” and “Next
” options (2.). Click the appropiate option to proceed.
8. Before the setup process is complete, you will get a chance to review all of the options you just configured (1.).
Additionally, you can also set the country/territory and timezone (2.) for the UniFi network controller to utilize on your Ubuntu system.
If you are happy with everything, you can click the “Finish
” button (3.) to complete the setup.
9. You should now have the UniFi network controller successfully installed on your Ubuntu system.
If you haven’t yet adopted any network devices, you will end up with a screen similar to the one shown below.
Conclusion
Throughout this tutorial, we have shown you how you can install and run the UniFi network controller on Ubuntu.
The UniFi controller allows you to easily control all of your Ubiquiti network devices from one central interface.
Please comment below if you have questions about running the UniFi controller on Ubuntu.
Be sure to check out our many other Ubuntu tutorials. Alternatively, we have plenty of general Linux guides that are well worth a read.
Weekly Updates Straight To Your Inbox
Receive our Raspberry Pi projects, coding tutorials, Linux guides and more!
Thank you for subscribing