Installing the UniFi Controller on the Raspberry Pi

With this tutorial, we will be showing you the process of installing the UniFi Controller on a Raspberry Pi

Raspberry Pi UniFi Controller
UniFi is a range of network devices created by Ubiquiti. These devices range from Wi-Fi access points to security gateways and switches.

Setting up the UniFi software on a Raspberry Pi is a fairly straightforward process as it just relies on the multi-platform Java runtime to run.

Using the UniFi network controller, you can manage all the UniFi devices that are a part of your network. You will also be able to use this dashboard to see the statistics of your UniFi network.

Equipment List

Below is a list of the equipment that you will need to set up the Unifi Network Controller software on your Raspberry Pi


Raspberry Pi 1, 2, 3 or 4

Micro SD Card

Power Supply

Ethernet Cord or WiFi dongle (The Pi 3 and 4 has WiFi inbuilt)


Raspberry Pi Case

This tutorial on setting up the UniFi Network Controller was tested on a Raspberry Pi 4 running the latest version of Raspbian Buster.

Preparing your Raspberry Pi for the UniFi Controller

In this section, we will be preparing the operating system so it can run the UniFi software.

1. The first thing you should do is ensure that your Raspberry Pi is running up to date packages.

To update all packages, you will be required to run the following command.

sudo apt update
sudo apt upgrade

2. Next, we need to install version 8 of the Java runtime environment to our Raspberry Pi by running the command below.

We need to install Java as the UniFi Network controller requires it to run.

sudo apt install openjdk-8-jre-headless

As of the time of posting, UniFi does not support newer versions of the Java runtime.

3. To improve the startup speed of the UniFi controller software on our Raspberry Pi, we need to install rng-tools.

We will utilize this package to ensure the Raspberry Pi has enough entropy for the random number generation that the UniFi software uses.

sudo apt install rng-tools

4. We now need to make a slight change to the rng-tools configuration.

Begin editing the config file by running the following command.

sudo nano /etc/default/rng-tools

5. Within this file, find and uncomment the following line.



Replace With


By uncommenting this line, we are adding to the amount of entropy (The amount of randomness) that the system has available.

The Raspberry Pi features an integrated random number generator that we can utilize to increase the entropy pool.

6. Once you have made the change, save the file by pressing CTRL + X, then Y, followed by ENTER.

7. Finally, restart the rng-tools service by running the command below.

sudo systemctl restart rng-tools

Once the service has finished restarting, it should now be safe to proceed to the next section of this guide.

Installing the UniFi Controller to the Raspberry Pi

1. Our first task is to add the UniFi repository to our sources list.

We can achieve this by running the command below.

echo 'deb stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list

2. We now need to add the repositories GPG key by using the following command.

sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg

The GPG key is what helps tell the package manager it is downloading the correct package.

3. As we made changes to the repositories, we need to now update the package list by running the command below.

sudo apt update

4. Now finally, we can install the Unifi Controller software to our Raspberry Pi by running the following command.

sudo apt install unifi

Installing UniFi through this method will automatically set up a service. This service will automatically start the UniFi software at boot.

First Boot of the UniFi Controller on your Raspberry Pi

In this section, we are going to walk you through the initial configuration steps of the UniFi software.

1. First, retrieve the local IP address for your Raspberry Pi.

If you have terminal access to your Pi, you can use the following command.

hostname -I

2. With your Raspberry Pi’s IP address handy, go to the following web address in your favorite web browser.


If you run into a certificate error, it is safe to ignore it as we know what device we are connecting to.

3. The first step requires you to give a name for your Raspberry Pi powered UniFi controller (1.).

You are also required to agree to the end-user license agreement and terms of service from UniFi, once you have read through them, click the checkbox (2.).

Once all done, click the “Next” button (3.) to proceed.

Set Name of UniFi Network

4. Next, you will need to sign in to your Ubiquiti account (1.).

If you don’t already have an account, you can register at the Ubiquiti website.

Once you have entered your login details, proceed by clicking the “Next” button.

Sign in to Ubitquiti Account

5. Tweak the settings on this page that best suits your needs.

Once configured, click the “Next” button.

UniFi Network Setup

6. Use this screen to connect your Pi UniFi Network controller to the devices on your network.

To proceed, click the “Next” button.

Connect Raspberry Pi to UniFi Devices

7. Now give your new Wi-Fi network a name and a password.

Once you have configured your WiFi details (1.), click the “Next” button to proceed (2.).

Setup UniFi WiFi Details

8. This final screen will get you to review all your settings.

You will also be able to use this screen to set both the country and timezone (1.). Make sure you set these before continuing.

Once you have verified everything is correct, you can now click the “Finish” button (2.) to finish the setup process.

Review Raspberry Pi UniFi Configuration Settings

7. At this point, you should now have successfully set up the UniFi network controller on your Raspberry Pi.

Raspberry Pi UniFi Dashboard

If you have run into any issues with setting up the UniFi software, feel free to drop a comment below.


  1. Avatar for Louis Apostolakis
    Louis Apostolakis on

    Thanks for the tutorial. However, unifi is not starting on boot. This is a new install of rpi and there is nothing else on the rpi besides unifi. How can I correct this?

    1. Avatar for Emmet
      Emmet on

      Hi Louis,

      Can you try running the following command. It should give us an idea of whether the service is enabled or not.

      sudo systemctl status unifi

      If it reports that its not “enabled”, try running the following command.

      sudo systemctl enable unifi</pre"


  2. Avatar for Stephanie
    Stephanie on

    This tutorial is FANTASTIC; the device is up an running!! Thank you so much. Question: is Pihole worth installing?

    1. Avatar for Emmet
      Emmet on

      Hi Stephanie,

      Pi Hole is very good at what it does and is a fantastic network-wide ad blocker if that is something you after. As it is a relatively lightweight software, you can probably get away with running it alongside the UniFi software.

      Of course, Pi Hole is far from a perfect solution as there is only so far a DNS based adblocker can get you. For example, with the way YouTube ads work these days it is hard to just block a particular domain name.

      More traditional adblockers (Such as uBlock or Adguard) that run as an extension of a web browser have access to any of the data the web browser exposes allowing it to detect and block more complicated ads.

      However, remember that when blocking ads you are cutting off a revenue stream for that website, so please consider other ways of supporting that website if you can afford to do so.


  3. Avatar for Thankful Dan
    Thankful Dan on

    Just want to add that you can navigate to the Unifi Controller UI by going to https://localhost:8443 just like in a Windows host machine, that way if you want your controller to be on a DHCP lease, you don’t have to constantly look up the IP.

    Great guide though, I wouldn’t have figured it out without this. Thank you.

  4. Avatar for Kaden
    Kaden on

    UniFi keeps giving me a “unifi cannot locate java home” error. I have gone through so many steps and tutorials that has been of no help. Has anyone seen this issue and found a fix for it?

    1. Avatar for Emmet
      Emmet on

      Hi Kaden,

      If possible could you please copy and paste the whole error, or screenshot it?

      May give me a better idea of what exactly is going wrong.


Leave a Reply

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