Install Unifi Controller On Raspberry Pi in 5 min

I have some smart products at home and one of the things I wanted to do is read out the connected WiFi devices. To do this I need to Unifi Controller to be running 24/7, so I needed a device to run the Unifi Controller on, something small, cheap, and with low running costs. That’s where the Raspberry Pi comes in.

In this article, I will help you install the Unifi Controller on the Raspberry Pi step-by-step in 5 minutes.

Unifi Controller on Raspberry Pi

Note

I have updated and tested this article on Jun 29th, 2023. This article fixed the problem with MongoDB and is based on Raspbian OS Lite 64-bit. The installed version of UniFi controller is 7.4.156 during the test.

What do we need for the Unifi Controller and Raspberry Pi?

Before we can start with installing the Unifi Controller on the Raspberry Pi we need to get some parts and download some software. Of course, we need to buy a Raspberry Pi. You can use a Model 3B, but if you have to buy one new I recommend getting a Model 4B

Also, you are going to need a MicroSD card, buy atleast a class A2 card. These are the fastest at the moment with 10MB/sec.

Download the following software to get started:

Step 1 – Getting the Raspberry Pi up and running

First, we are going to start by installing Raspbian on de MicroSD card. We will use the Raspberry Pi Imager to easily install the correct Raspbian OS version. The advantage of this tool is that we can select the Raspbian version we want to install, enable SSH and configure the wireless network. We are going to install the 64-bit lite version of Raspberry Pi OS, this version comes without a desktop which we don’t need.

Place the MicroSD card in your computer and open Raspberry Pi Imager:

  1. Click Choose OS
  2. Select Raspberry Pi OS (other)
  3. Choose Raspberry Pi OS Lite (64bit)
  1. Click on Choose Storage
  2. Select your MicroSD card (check the size and drive letter!)
  3. Click on Settings (Gear icon) in the lower-right corner
    • Enable SSH
    • Set username and password for SSH connection
    • Enable Configure wireless LAN
    • Click on Save
  1. Click on Write
  2. You will get a warning that all data will be removed, click Ok and get a coffee 😉
  3. Wait until the process is finished
Install raspbian

Optional – Activate SSH

This step is only required when you haven’t enabled SSH in the Raspberry Pi Imager tool. Otherwise, you can skip this step and continue with Step 2.

We don’t want to connect a keyboard and monitor to our Raspberry Pi everything we need to update or change something. So the first thing we do is enable SSH so we can connect remotely to the PI.

Now the following steps should work also on a Windows machine, but I had multiple times that I was unable to open de SD card in Windows Explorer. Don’t waste your time trying if you have the same, just follow the Alternative way to enable SSH below.

Add new text file ssh to the SDCard

So you should be able to do the following to enable SSH:

  1. Open your explorer and open de MicroSD card. (it’s called boot).
  2. Add a new text file and name it SSH
  3. Make sure you remove .txt from the file name. So you are left with a file just named SSH.

If you have trouble opening the SDCard in Windows you can try to use another computer or skip this part. You will then need to connect a monitor (or TV) and keyboard to the Pi and follow the step under Alternative way to enable SSH

Plug the MicroSD card into the Rasberry Pi and connect the power and ethernet cable. The PI will now startup.

An alternative way to enable SSH

Make sure you have a keyboard and monitor/tv connected. Login to the Pi with the following login:

Username: pi
Password: raspberry

Type the following command to open the settings page:

sudo raspi-config
  • Select 5. Interfacing Options
  • Scroll down to 2. SSH and press enter to enable it
  • When down press ESC to exit the settings page.

You have now enabled SSH and can continue the follow this guide.

Step 2 – Connecting with SSH

You can connect to your Raspberry Pi using the default hostname raspberrypi.local. Sometimes this doesn’t work, due to your network configuration. In that case, you will need to look up the IP Address of your Pi.

Optional – Find the Ip Address

We need to find the IP Address of the PI. Open Advanced IP Scanner and click on scan.

Advanced Ip Scanner to find raspberry pi

In the results, you will see the Raspberry Pi, note the IP Address, in my case, it’s 192.168.1.210.

Connecting to the PI

To connect to the Pi we can use PowerShell (or Windows Terminal) which is installed by default on your Windows 10/11 computer. Right-click on Start and open PowerShell or Windows Terminal.

We are going to connect to the Pi using SSH. For this, we will need the SSH username and password that you configure in the settings of the Raspberry Pi imager. If you didn’t change the settings then you can use the default credentials:

Username: pi
Password: raspberry

To connect to the Pi type the following command:

# Replace pi with the username that you have set
# Optional - replace raspberry with the IP address of teh pi

ssh pi@raspberry

Alternative – Connecting to the PI with Putty

Open Putty that you downloaded earlier. Enter raspberrypi.local or the IP Address that we found in the Advanced Ip Scanner and click on Open

Connecting to the raspberry pi with putty

You will get a warning if we trust the host. We do so click yes

SSH security warning

You will need to log in, the default credentials are:

Username: pi
Password: raspberry

ssh to unifi controller raspberry pi

Step 3 – Setting up the Raspberry Pi

Before we are going to install the Unifi Controller on the Raspberry Pi we first going to set up the Raspberry Pi self. You can copy-paste the command in Putty. Just copy from this article and right-click in PowerShell/Terminal or Putty.

Set a static IP Address

By default, the Pi is using DHCP to get an Ip address. This means that a reboot can cause it to get a new Ip address, which will make it hard to manage it with SSH or to open the Unifi Controller.

So we are going to set a static Ip Address on the network interface:

  1. First, let’s check the current network details. Type: ifconfig
    In the result you will see eth0 and in that block inet: 192.168.x.x. This is the current ip address.
  2. To edit the network config file type the following cmd:
sudo nano /etc/dhcpcd.conf

3. Enable to following lines by removing the # from it and set an IP address to a fixed value

#Static IP configuration:
interface eth0
static ip_address=192.168.1.210/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 1.1.1.1 fd51:42f8:caae:d92e::1

In this case, we set the IP address to 192.168.1.210 and the address of the internet router is 192.168.1.1. You also need to set the domain_name_servers, by default entering the router’s address is enough.

Which ip address should you pick? If you don’t know your network layout, keep the first 3 parts of the address the same and choose a value between the 200 and 240 at the end.

When done save and close the file by pressing ctrl + x and choose Y to save it.

Now we need to restart the network interface to apply the settings. Simply reboot the Pi with the cmd below. Wait a minute and connect to the PI with Putty on the new IP Address.

sudo reboot

Change the default Password

Just with every (network)device you have, you should change the default password. To change the password you will need to enter the current password first and then enter the new password twice:

Enter the cmd passwd:

pi@raspberrypi:~ $ passwd
Changing password for pi.
(current) UNIX password:raspberry
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Updating your Raspberry

Before we start installing software on the PI, we will make sure the Raspberry Pi is up-to-date. With the cmd below we will update the firmware, software and clean up unused and old software.

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove && sudo apt-get autoclean

This may take a minute or two.

Install haveged

Not really necessary, but the startup of the Unifi Controller can take a bit long on a Raspberry Pi due to the fact there is no user interaction. Now your Pi should be running 24/7, so it’s not a big deal, but we can speed it up anyway.

Install haveged to solve the issue with the following cmd:

sudo apt-get install haveged -y

Update Java 11

This step is pretty important with the newer release of the Unifi Controller. Starting with version 5.10.x the old Java version that comes with Raspbian isn’t supported anymore. So we are going to replace it with OpenJDK 11.

sudo apt install openjdk-11-jre-headless -y

Split memory

If you run the Raspberry Pi without a monitor connected you can safely reduce the amount of ram used by the GPU. By default, the Pi has assigned 64MB RAM to the GPU. Because we are using CLI (Command Line Interface) to work on the Pi, we can reduce that amount for RAM, leaving more RAM available for the Pi itself.

Open the Raspberry Pi config with the following command:

sudo raspi-config
  1. Select 4. Performance Options
  2. P2 GPU Memory
  3. Change 64 to 16MB
  4. Hit Enter and use Esc to close the config screen.

Make sure you reboot the Pi to apply the changes.

Step 4 – Installing the Unifi Controller Raspberry Pi

So with our Raspberry Pi ready we can start with installing the Unifi Controller on the Raspberry Pi.

1. Install MongoDB

The Unifi controller uses MongoDB for its database to store all information. MongoDB is also built-in in the Unifi package, but that is not the right version for the Raspberry Pi. So we are going to install the correct 64-bit version manually.

But before we can do that we will need to install an older version of LibSSL:

# Download the package
wget http://ports.ubuntu.com/pool/main/o/openssl/libssl1.0.0_1.0.2g-1ubuntu4_arm64.deb -O libssl1.0.deb

# Install it:
sudo dpkg -i libssl1.0.deb

Now we can download and install MongoDB 3.6 which we need for the UniFi Controller:

# Download the package
wget https://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/3.6/multiverse/binary-arm64/mongodb-org-server_3.6.22_arm64.deb -O mongodb.deb

# Install it
sudo dpkg -i mongodb.deb

We will need to make sure that MongoDB is automatically started after rebooting the Pi:

sudo systemctl enable mongod

# And start it for now manually:
sudo systemctl start mongod

2. Add the repository for the Unifi Controller

All Linux distros come with a source list, repository, of available packages to install. Unifi Controller is not listed in the default repositories, so we need to add it first:

echo 'deb http://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list

To install the Unifi Controller software we need to authenticate the software that it’s the real software from Ubiquiti. This can be done with a GPG key so we can authenticate the software.

sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ubnt.com/unifi/unifi-repo.gpg

3. Install the Unifi Controller

We now have added the software to our list of available software and have the ability to check its authenticity. So let’s download the software and install the Unifi Controller on the Raspberry Pi:

sudo apt-get update; sudo apt-get install unifi -y

3. Finished installing the Unifi Controller on the Pi

The only step left is to reboot the Pi

sudo reboot
Unifi Controller Raspberry Pi

Wrapping up

After the reboot, you can log in to the Raspberry Pi with your browser. Go to the Ip address you set earlier (for example https://192.168.1.210:8443)

The setup wizard page will be displayed allowing you the create a new site or restore a backup. Check this post for some tips on how to optimize your controller or how to add access points.

Make sure you back up your Unifi Controller properly. Updates can brick your controller or even Pi, so the best solution is to back up your controller to cloud storage, like Dropbox. You can read this article on how to set it up (it only takes another 5 minutes 😉 )

You may also like this article where I will guide you through installing Home Assistant on your Raspberry Pi using Docker.

Keeping the Unifi Controller up to date

It’s important to keep your network products up-to-date. New firmware contains important security fixes, fixes bugs in the software, and can enhance the performance of a device. Check out this post on how to update the Unifi Controller and signup for the newsletter. I will drop you an email when there is a new version available!

Common errors

During the installation, you might get an error. It happens sometimes with Linux-based systems. You can check the comments below for issues others have run into. One of the problems I had during the installation was this:

unexpected end of file or stream
abort-upgrade: please reinstall previous version

One of the first things you can try is to clean up the downloaded list from APT. This way the files will be downloaded again, solving any issue with corrupt files during the download:

sudo apt-get clean

404 error – not found

If you have installed the Unifi Controller and get a 404 error after you have restored the Pi then there is a problem with the Unifi services.

You can check the status of all services on your Raspberry Pi with the following command:

sudo service --status-all

All services that are running are listed with a + in front of it. The Unifi service may be turned off, or even maybe listed as running, but clearly malfunctioning.

We can easily fix this by (re)starting the services:

service unifi start

You may need to enter your password again, but after that, the Unifi Controller should be running.

You probably also like the following articles:

241 thoughts on “Install Unifi Controller On Raspberry Pi in 5 min”

  1. Hello,
    I am getting this error

    “The Console data partition is nearly full. Only 0 B of 234 GB free” and I have the logs to normal, and backup to every day (settings only), with retention to 4 files. las backup was 2 weeks ago
    did a “compact database”

    but still… any help with commands to clear the log files/ free up space without having to reinstall the whole thing … thank you

      • Hello, I think the issue is with my logs… how do I clear/clean them up without affecting the unifi installation… dont mind loosing the history?

        /usr/lib/unifi/logs# ls -l
        -rw-r—– 1 unifi unifi 72455 Oct 21 03:29 hs_err_pid26382.log
        -rw-r—– 1 unifi unifi 69466 Aug 3 2022 hs_err_pid3516.log
        -rw-r—– 1 unifi unifi 40824832 Mar 20 20:06 mongod.log
        -rw-r—– 1 unifi unifi 183767040 Jan 31 00:00 mongod.log.1
        -rw-r—– 1 unifi unifi 3472743 Jan 30 00:00 mongod.log.2.gz
        -rw-r—– 1 unifi unifi 2015075 Jan 27 00:00 mongod.log.3.gz
        -rw-r—– 1 unifi unifi 1996872 Jan 24 00:00 mongod.log.4.gz
        -rw-r—– 1 unifi unifi 1910368 Jan 10 00:00 mongod.log.5.gz
        -rw-r—– 1 unifi unifi 1734056 Jan 7 00:00 mongod.log.6.gz
        drwxr-x— 2 unifi unifi 4096 Mar 20 18:47 remote
        -rw-r—– 1 unifi unifi 544768 Mar 20 20:06 server.log
        -rw-r—– 1 unifi unifi 1626112 Mar 20 19:22 server.log.1
        -rw-r—– 1 unifi unifi 2375680 Mar 20 18:32 server.log.2
        -rw-r—– 1 unifi unifi 452110 Mar 20 17:39 server.log.3

          • Thank you.. this helped.. but still have caos.
            by removing the log.x files I freed up some space that allowed me to make a backup. (as before could not do it)

            before removing the log files
            my scenario was like this.
            Filesystem 1K-blocks Used Available Use% Mounted on
            /dev/root 245866672 235843048 0 100% /

            now is

            Filesystem 1K-blocks Used Available Use% Mounted on
            /dev/root 245866672 235663624 177108 100% /

            how can I find out what is taking so much space? and thus free more space.

            thank you.

          • can we also safely delete the
            server.log.x files ?
            Sill after 3 days.. my spaces goes out.. completely.

  2. …but in the end no luck yet.

    pi@rasp4:~ $ sudo systemctl status unifi.service
    ● unifi.service – unifi
    Loaded: loaded (/lib/systemd/system/unifi.service; disabled; preset: enabled)
    Active: activating (start-post) (Result: exit-code) since Tue 2024-01-02 13:38:51 UTC; 2min 16s ago
    Main PID: 754 (code=exited, status=1/FAILURE); Control PID: 755 (unifi-network-s)
    Tasks: 2 (limit: 1585)
    CPU: 2.306s
    CGroup: /system.slice/unifi.service
    ├─ 755 /bin/bash /usr/sbin/unifi-network-service-helper healthcheck
    └─1170 sleep 3

    Jan 02 13:38:52 rasp4 unifi[753]: Skipping init-uos…
    Jan 02 13:38:52 rasp4 unifi-network-service-helper[753]: Jan 2 13:38:52 unifi: Skipping init-uos…
    Jan 02 13:38:52 rasp4 unifi[763]: health-check max retry count: 300
    Jan 02 13:38:52 rasp4 unifi-network-service-helper[763]: Jan 2 13:38:52 unifi: health-check max retry count: 300
    Jan 02 13:38:53 rasp4 java[754]: [0.078s][error][logging] Error opening log file ‘logs/gc.log’: No such file or directory
    Jan 02 13:38:53 rasp4 java[754]: [0.078s][error][logging] Initialization of output ‘file=logs/gc.log’ using options ‘filecount=2,filesize=5M’ failed.
    Jan 02 13:38:53 rasp4 java[754]: Invalid -Xlog option ‘-Xlog:gc:logs/gc.log:time:filecount=2,filesize=5M’, see error log for details.
    Jan 02 13:38:53 rasp4 java[754]: Error: Could not create the Java Virtual Machine.
    Jan 02 13:38:53 rasp4 java[754]: Error: A fatal exception has occurred. Program will exit.
    Jan 02 13:38:53 rasp4 systemd[1]: unifi.service: Main process exited, code=exited, status=1/FAILURE

  3. In the second step, the paragraph header is ‘Update Java 11’, when entering the command the response is:

    Package openjdk-11-jre-headless is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    E: Package ‘openjdk-11-jre-headless’ has no installation candidate

    I get this error trying to install Unifi on a Raspberry Pi 4B using the ‘bookworm’ OS.

    I tried setting the repository to ‘buster’ as suggested in a post on another forum, but that resulted in the same error.

  4. I had this running on an old Raspberry Pi 2B using the previous instructions but obviously the latest version won’t run on this so bought myself a Pi 4B. Tried to run through instructions but getting the following when I try and install the Unifi software. All previous steps completed successfully.

    sudo apt-get update; sudo apt-get install unifi -y
    Hit:1 http://archive.raspberrypi.org/debian bullseye InRelease
    Hit:2 http://deb.debian.org/debian bullseye InRelease
    Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
    Hit:4 http://security.debian.org/debian-security bullseye-security InRelease
    Hit:5 https://dl.ui.com/unifi/debian stable InRelease
    Reading package lists… Done
    N: Skipping acquire of configured file ‘ubiquiti/binary-armhf/Packages’ as repository ‘http://www.ui.com/downloads/unifi/debian stable InRelease’ doesn’t support architecture ‘armhf’
    N: Skipping acquire of configured file ‘ubiquiti/binary-arm64/Packages’ as repository ‘http://www.ui.com/downloads/unifi/debian stable InRelease’ doesn’t support architecture ‘arm64’
    Reading package lists… Done
    Building dependency tree… Done
    Reading state information… Done
    E: Unable to locate package unifi

    Any ideas?

    • Hi all,

      For some reason I am now receiving the following error when running “sudo apt update”.

      I am using 64bit OS. Unifi controller also seems to update fine to the latest version.

      N: Skipping acquire of configured file ‘main/binary-arm64/Packages’ as repository ‘https://repo.mongodb.org/apt/debian stretch/mongodb-org/3.6 InRelease’ doesn’t support architecture ‘arm64’

      Any ideas how to fix please?

      Thanks all.

  5. Used these today to rebuild my Pi using the 64-bit OS install. Everything worked fine. Thanks for writing up the update.

  6. As Paul indicated, the latest version of the software is 64 bit and it gives me a lot of problems on the raspberry. How can I install version 7.3.X (32bit) with a clean install?
    (Google Translate)

      • I found that there were no problems with the step-by-step instructions. I installed it on a Raspberry Pi 3B…..but it seems that after 1-2 days of running the controller, the load numbers creep up and eventually the controller crashes. If I reboot the machine it will recover… but again the load numbers will eventually creep up and cause the system to crash again.
        **Update, it seems my “controller frozen” problem is due to trying to run the controller on Pi3 with only 1Gb RAM… I thought I read somewhere that the minimum recommended memory is 2Gb with this version and dependencies. I’ve since installed on a Pi4 with 4Gb and it works fine, with low load counts and no freezing.

        This is an exact description of also my problem that I found on the Unifi community, I also found the cause and solution there.

        Google Translate

  7. Please note, you CANNOT use the latest version of Unifi controller on 32bit OS.
    I updated and everything went pear-shaped. Rebuilding everything now…….. in 64bit

    • Yes, these instructions are somewhat out of date now, for example a newer version of MongoDB is required by the Unifi controller. Adding the MongoDB repositories for bullseye (rather than stretch referenced in this article) works.

  8. I followed this Instructions with Raspi PI4 but after the Installation the Unifi Service doesn’t start.
    Systemctl status unifi.service shows:
    unifi.service – unifi
    Loaded: loaded (/lib/systemd/system/unifi.service; enabled; vendor preset: enabled)
    Active: activating (start-post) since Mon 2023-05-01 13:34:22 CEST; 3min 33s ago
    Process: 2670 ExecStartPre=/usr/sbin/unifi-network-service-helper init (code=exited, status=0/SUCCESS)
    Process: 2705 ExecStartPre=/usr/sbin/unifi-network-service-helper init-uos (code=exited, status=0/SUCCESS)
    Main PID: 2714 (java); Control PID: 2715 (unifi-network-s)
    Tasks: 42 (limit: 3933)
    CPU: 51.802s
    CGroup: /system.slice/unifi.service
    ├─2714 /usr/bin/java -Dfile.encoding=UTF-8 -Djava.awt.headless=true -Dapple.awt.UIElement=true -Dunifi.core.enabled=false -Xmx1024M -XX:+UseParallelGC -XX:+ExitOnOutOfMemoryError -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/usr/lib/unifi/logs/hs_err_pidunifi.log -jar /usr/lib/unifi/lib/ace.jar start
    ├─2715 /bin/bash /usr/sbin/unifi-network-service-helper healthcheck
    └─3245 sleep 3

    May 01 13:34:22 raspberrypi systemd[1]: Starting unifi…
    May 01 13:34:22 raspberrypi unifi[2704]: init complete…
    May 01 13:34:22 raspberrypi unifi-network-service-helper[2704]: May 1 13:34:22 unifi: init complete…
    May 01 13:34:22 raspberrypi unifi[2713]: Skipping init-uos…
    May 01 13:34:22 raspberrypi unifi-network-service-helper[2713]: May 1 13:34:22 unifi: Skipping init-uos…
    May 01 13:34:33 raspberrypi java[2714]: WARNING: An illegal reflective access operation has occurred
    May 01 13:34:33 raspberrypi java[2714]: WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoaderBase (file:/usr/lib/unifi/lib/tomcat-embed-core-9.0.59.jar) to field java.io.ObjectStreamClass$Caches.localDescs
    May 01 13:34:33 raspberrypi java[2714]: WARNING: Please consider reporting this to the maintainers of org.apache.catalina.loader.WebappClassLoaderBase
    May 01 13:34:33 raspberrypi java[2714]: WARNING: Use –illegal-access=warn to enable warnings of further illegal reflective access operations
    May 01 13:34:33 raspberrypi java[2714]: WARNING: All illegal access operations will be denied in a future release

    Any Idea?

    • Did you investigate the “ExitOnOutOfMemoryError”? It appears that you ran out of available memory. The other errors may be due to running out of memory? One option to check memory is to enter
      df -h
      as a command and see what your memory usage is.

      • Filesystem Size Used Free. Free%
        /dev/root 29G 8.2G 20G 30% /
        devtmpfs 1.7G 0 1.7G 0% /dev
        tmpfs 1.9G 0 1.9G 0% /dev/shm
        tmpfs 759M 828K 759M 1% /run
        tmpfs 5.0M 4.0K 5.0M 1% /run/lock
        /dev/mmcblk0p1 253M 51M 202M 20% /boot
        tmpfs 380M 0 380M 0% /run/user/1000
        tmpfs 380M 0 380M 0% /run/user/1001

  9. Hi,

    just installed a new raspberry with the new version.
    Now Unifi controler isn’t automatically starting after a reboot.

  10. Please note that user/password pi/raspberry is no longer supported. SSH support and creation of user is done already in the Raspberry Pi imager.

  11. I do really appreciate how to clean storage, as about every year, I am running out of space, and my only solution has been to reformat and resinstall
    I even try the mongo_prune_js.js script and its unsucessfull.

    my backups are set to 7 days and only 5 files to keep…

    I guess stats are bloading my space… even when I use the compact datase it doesnt clear space use..

    what ideas do you have ?

    • I had an issue with logs filling up the /var/log/unifi directory. I manually set log rotation for:
      – /var/log/unifi/server.log
      – /var/log/unifi/mongod.log

      What I did:
      sudo nano /etc/logrotate.d/mongodb_unifi

      Edited the file to read like this, and saved it:
      # This configuration file manually added to limit the space this log file takes up.
      # Originally no configuration file was present for the unifi version of mongodb.
      /var/log/unifi/mongod.log {
      daily
      rotate 7
      copytruncate
      compress
      notifempty
      missingok
      }

      Then I deleted the old log and freed up the space:
      sudo rm /var/log/unifi/mongod.log
      sudo service unifi restart

      If in the unifi controller you have the server set, then set the same rotation for
      /var/log/unifi/server.log

  12. Somehow I cannot connect to raspbian.raspberrypi.org/. Any idea?

    pi@raspberrypi:~ $ sudo apt-get install openjdk-8-jre-headless -y
    Reading package lists… Done
    Building dependency tree… Done
    Reading state information… Done
    The following additional packages will be installed:
    ca-certificates-java java-common libavahi-client3 libcups2 liblcms2-2 libxi6 libxrender1 libxtst6 x11-common
    Suggested packages:
    default-jre cups-common liblcms2-utils fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei
    fonts-wqy-zenhei fonts-indic
    The following NEW packages will be installed:
    ca-certificates-java java-common libavahi-client3 libcups2 liblcms2-2 libxi6 libxrender1 libxtst6 openjdk-8-jre-headless
    x11-common
    0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
    Need to get 27.2 MB of archives.
    After this operation, 97.3 MB of additional disk space will be used.
    Err:1 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf java-common all 0.72
    Temporary failure resolving ‘raspbian.raspberrypi.org’
    0% [Connecting to raspbian.raspberrypi.org]^

  13. We need new tutorial with the new image (bullseye) we have problems.
    Or we can just go with the old one buster(but i think we also have problems)?

      • Having problems too with Bullseye. This is the terminal output:

        Hit:1 http://archive.raspberrypi.org/debian bullseye InRelease
        Hit:2 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
        Ign:3 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 InRelease
        Hit:5 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 Release
        Hit:4 http://dl.ubnt.com/unifi/debian stable InRelease
        Reading package lists… Done
        Reading package lists… Done
        Building dependency tree… Done
        Reading state information… Done
        Some packages could not be installed. This may mean that you have
        requested an impossible situation or if you are using the unstable
        distribution that some required packages have not yet been created
        or been moved out of Incoming.
        The following information may help to resolve the situation:

        The following packages have unmet dependencies:
        unifi : Depends: mongodb-server (>= 2.4.10) but it is not installable or
        mongodb-10gen (>= 2.4.14) but it is not installable or
        mongodb-org-server (>= 2.6.0) but it is not installable
        Depends: mongodb-server (< 1:4.0.0) but it is not installable or
        mongodb-10gen (< 4.0.0) but it is not installable or
        mongodb-org-server (< 4.0.0) but it is not installable
        E: Unable to correct problems, you have held broken packages.

      • Some packages could not be installed. This may mean that you have
        requested an impossible situation or if you are using the unstable
        distribution that some required packages have not yet been created
        or been moved out of Incoming.
        The following information may help to resolve the situation:

        The following packages have unmet dependencies:
        unifi : Depends: mongodb-server (>= 2.4.10) but it is not installable or
        mongodb-10gen (>= 2.4.14) but it is not installable or
        mongodb-org-server (>= 2.6.0) but it is not installable
        Depends: mongodb-server (< 1:4.0.0) but it is not installable or
        mongodb-10gen (< 4.0.0) but it is not installable or
        mongodb-org-server (< 4.0.0) but it is not installable
        E: Unable to correct problems, you have held broken packages.

      • also having problems with the new image

        this is what i get when trying to install the controller:

        pi@raspberrypi:~ $ sudo apt-get update; sudo apt-get install unifi -y
        Hit:1 http://archive.raspberrypi.org/debian bullseye InRelease
        Hit:2 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
        Hit:3 http://dl.ubnt.com/unifi/debian stable InRelease
        Reading package lists… Done
        Reading package lists… Done
        Building dependency tree… Done
        Reading state information… Done
        Some packages could not be installed. This may mean that you have
        requested an impossible situation or if you are using the unstable
        distribution that some required packages have not yet been created
        or been moved out of Incoming.
        The following information may help to resolve the situation:

        The following packages have unmet dependencies:
        unifi : Depends: mongodb-server (>= 2.4.10) but it is not installable or
        mongodb-10gen (>= 2.4.14) but it is not installable or
        mongodb-org-server (>= 2.6.0) but it is not installable
        Depends: mongodb-server (< 1:4.0.0) but it is not installable or
        mongodb-10gen (< 4.0.0) but it is not installable or
        mongodb-org-server (< 4.0.0) but it is not installable
        E: Unable to correct problems, you have held broken packages.

  14. Superbly Explained and was a great tutorial. I followed accordingly and completed in just one go. I am really very satisfied with the explanation given to what the command does and also the new extra things to accomplish the goal like allocating the memory for the display to 16 and also deleting extra files for a headless display. My hearty thanks to the author.
    Thank you Once again for an easy setup and tutorial.

  15. In the UK, Cloud Keys are scarce, probably everywhere.
    But when I found this guide it was a blessing in disguise.
    I use this guide all of the time.

    I noticed one of the posts, if I understand correctly, they have 1 Pi and it manages multiple sites.
    I ask as I have a site with 7 clients / apartments on it, I have trunks from the core to all of the apartments, does this mean I could possibly Run a Pi to handle all of those apartments?

  16. Fantastic guide – I’ve tried three today with no luck. This guide worked perfectly – up and running and saved me £80.

  17. Out of curiosity I tried a Pi Zero (v1.1) as a unifi controller. I set up the Pi from scratch using the 32-bit Lite version (Buster).
    The unifi controller installation locked up, probably due to a memory limit somewhere. Moved the SD-card to a Pi 3B, redid the ‘sudo apt-get install unifi -y’ command, and once complete moved the SD-card back to the Pi Zero and went on with the installation from there.
    Of course the response is not lightning-fast, but everything works as expected. The controller is in actual service at my son’s home. The controller currently manages (only) two access points.

  18. Hi,
    great guide !! and it worked for me as well.
    But it installed the latest version 6.1.71 which I do not want as I first want my Raspberry to run the same version (6.0.45) as on my MAC.
    I followed the instruction in the comments to Christians question on Nov 22, 2020 but got the same error and this was never answered
    The content of my 100-ubnt-inifi-list is
    deb http://www.ubnt.com/downloads/unifi/debian unifi-6.0.45 ubiquiti
    but i get the same error:
    pi@unificontroller:~ $ sudo apt-get update; sudo apt-get install unifi -y
    Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
    Hit:2 http://archive.raspberrypi.org/debian buster InRelease
    Ign:3 https://dl.ubnt.com/unifi/debian unifi-6.0.45 InRelease
    Err:4 https://dl.ubnt.com/unifi/debian unifi-6.0.45 Release
    404 Not Found [IP: 65.9.62.151 443]
    Reading package lists… Done
    E: The repository ‘http://www.ubnt.com/downloads/unifi/debian unifi-6.0.45 Release’ does not have a Release file.
    N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package unifi is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘unifi’ has no installation candidate

  19. I have followed all instructions to install the controller on a new Raspberry 4 (where all the software was already present on the SD card). After the restart, it was not possible to log in at first, but then the controller wanted to start the installation completely all over again. I do have an already existing installation with a controller on my MacAir. I don’t want to lose this, but I don’t want to run the controller on the Mac anymore, but separately on the Raspberry. Is it possible to boot the controller on the Raspberry with the whole existing setup?

  20. Hi everyone,

    how can I select an older firmware during installation. With the above procedure the current one is always loaded from the Unifi homepage. What must be changed in the procedure?

    Thanks!

    • You first need to remove the current stable version from the source list

      sudo echo '#deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti'

      Then add an older version to the source list:
      sudo echo 'deb http://www.ubnt.com/downloads/unifi/debian unifi-5.14 ubiquiti' | sude tee /etc/apt/sources.list.d/100-ubnt-unifi.list

      When done you can run the update commend:
      sudo apt-get update; sudo apt-get install unifi -y

  21. Made another install on the latest OS release. The instructions (as always) are great. One minor thing has changed in a recent OS release – the ‘Memory Split’ option has moved in the Pi Software Config Tool. It was under ‘7 – Advanced Options’, now it can be found under ‘4 – Performance Options’, it is then the second option (P2 GPU Memory).

  22. Hi,

    Fantastic guide, tried using others but yours worked spot on and indeed in 5ish minutes. Installed on a RPi 4 and working like a dream.

    Loved the extra tip, re memory management to gain extra space when not using GUI.

    Installing a RPi cluster now, for my Home automation; Pi Hole and Unify. But getting the base system was so much easier than I expected.

  23. Installed on raspberry 2 and on 3b and model 4B but always the same when I want to log in on 192.168.99.118:8443
    Bad Request
    This combination of host and port requires TLS.

    Several times start again wit a clean install and n0 errors.
    What to do now

  24. Hello,
    today the SD card died on my Pi, and my latest backup that I downloaded off the pi was from a month ago… so I have a lot of work with new sites to re-adopt.

    Since the Pi, has USB connectors… will it be possible to insert a USB thumdrive to the PI and have the backup on this external USB drive ??

    anyone with ideas ?
    I which it could email the backup

    • you still cannot boot directly to USB UFD. There is some jiggery pokery to boot first to SDcard. Next SDcard pick samsung PRO as these are high endurance used by carcams and the like. When they were available Class 6 was a better choice for a file system.

  25. Hello,
    Today I was adding a client site to my controller on the Pi.
    all went well, exept at the end when I was wraping up and closing the job, I realized that my Controller was unreachable, not even locally it comes up.

    since 1PM til 4:00 PM during the installation it was reachable and working, and now I don’t have access to it.

    the worst part is that my backup doesn’ include the site/job I did today.

    Any ideas or pointers are greatly appreciated.
    maybe my controller ran out of space ? I have to go to the office tomorrow, and check, bult also appreciate how can I release / delete files if this is the case so it comes up again ? it is the only thing that occrurs to me.

    I wanted to get a heads up, as tomorrow will look at the log files and follow up on this post

    my controller is on version 5.12.35 and my last backup was of yesterday.
    I haven’t upgraded as I see that the upgrade instructions there are a lot of “if you get this error, then”
    so usually, I dump a backup and do a reinstall.

    • Where do you have the Pi running? You say you can’t reach the controller, but do have still access to the Pi? And what is the status of the unifi service on the Pi?

  26. Hello, I moved to a Pi following these instructions and so far so good. But today I wanted to add a new site to my controller, and I get an simple error adding site, and it doesn’t add it. are there restrictions ?
    My controller has 20 sites, and to my understanding there is no limit on the quantity of sites.
    My user is a superadmin
    any help is greatly appreciated.

    • Do you have the latest version running (5.13.29), you can check it in Settings > Controller Settings > Basic. I just tested it on my controller and it working fine. Check also the amount of free space on your Pi, just to be sure. In SSH the command df

  27. I had a UniFi controller on a Raspberry Pi; however, that data is no longer available, so this guide allowed me to build a new one. Thanks for this guide.

    Now that I have it operational, the access points are showing as Managed/Adopted already. (by the old controller that I do not have anymore.) On top of this, those access points are using old firmware, 4.0.10.9653.

    Any ideas on how to get the access points to be adopted by this new controller?

    Alternately, how to upgrade those access points manually?

    • you have to do the AP upgrades “step wise” through CLI. 3.x.x -> 4.0.1 -> 4.x.x.

      That usually works for me when an AP wont take the update. all of the past releases are on the UI site. also I have found that it takes the update smoothly if you cache the updates in the controller (its in the settings)

  28. Thanks very much for the guide! Followed all steps to the letter but upon attempting to access the controller, I get an ERR_Connection_Refused error message (This site can’t be reached. 192.168.1.210 refused to connect.) in my browser. I can still access the Raspberry Pi Model B via PuTTY with no issue. Looked at similar comments and attempted fixes to no avail.

    With a new install (no errors encountered), I am using a wired connection, connected to a BT Home Hub 6 router (IP Address: 192.168.1.254). I am using the following IP configuration.

    #Static IP configuration:
    interface eth0
    static ip_address=192.168.1.210/24
    #static ip6_address=fd51:42f8:caae:d92e::ff/64
    static routers=192.168.1.254
    static domain_name_servers=192.168.1.254 1.1.1.1 fd51:42f8:caae:d92e::1

    Any advice on how I should proceed? Thanks in advance.

      • Haveged is running but have managed to get working by adding Port 8443 to end of URL. i.e. https://192.168.1.210:8443/

        Do you think a 1st generation raspberry pi model B+ would be able to run pi hole as well? If not would a 4th generation rapsberry pi with 1gb RAM be overkill? Heard a Raspberry Pi Zero encounters problems?

        Thanks again for the guide!

        • Ah, the port number totally overlooked that in your first comment.

          I have a model 3 running and in the last couple of months I find it particularly slow when loading the controller. So I don’t think a 1ste gen will run smoothly after a while. A Raspberry Pi 4 is something I am looking into as well to replace my current model 3. And for the money, I would go for the Raspberry Pi 4 – 2GB RAM, only $2 more.

  29. Hi, I will cut straight to the chase. I have followed and successfully installed the controller on my Raspberry Pi 2B with your guide. I thought I would get a head start of configuring my raspberry pi so when I get my router and switch I can just connect it straight. I’ll attach a network diagram link for a better idea https://bit.ly/3bnumVT

    Currently, I have my Raspberry Pi 2B setup/configured with my ISP router/modem. Now that I have all my gear, would I run into issues when connecting it with my usg3 and switch or do I need to start from scratch again? In reference to step #3 below which I have followed, can I or would I have an issue now setting it up with Usg 3 or would it work? I’m connecting with Cat6a poe cable which is on the way, so I will use cat 5e, for now, to set things up. Please advise what is the best course of action.

    3. Enable to following lines by remove the # from it and set IP address to a fixed value

    #Static IP configuration:
    interface eth0
    static ip_address=192.168.1.210/24
    #static ip6_address=fd51:42f8:caae:d92e::ff/64
    static routers=192.168.1.1
    static domain_name_servers=192.168.1.1 1.1.1.1 fd51:42f8:caae:d92e::1

    • The only problem you are going to run into is the different IP Range. Currently, the local range is 192.168.0.x, when you connect the USG, the local network will change to 192.168.1x (according to your diagram). So you will have to re-configure your Pi, and access points.

      An option is to keep your local range 192.168.0. and give your modem and USG an IP address in the range 192.168.1.x. This way you won’t have to change anything to your local network.

    • Hi, I’ve purchased Rpi 4B with 32GB even bought RPI PoE Hat and rasbian lite buster Feb 2020 version. This Linux worked perfectly fine with my old Rpi 2B.
      The issue here is, when I power up my Rpi 4b. I cannot get an IP nor I can access ssh. The ethernet cable is connected but I can’t discover it neither on Angry Scanner and Advance IP. I’m trying with ethernet cable. I heard this is an issue for all Rpi 4B? I spend entire day trying to figure out. I can’t discover it and therefore I can’t ssh due to I don’t have an IP .

      Please help.
      Thank you in advance 🙂

      • I think the quickest way to determine the issue is to connect a monitor (TV screen) and keyboard. This way you can use the local terminal/CLI to see what IP Address it has or what the network settings are.

  30. Hi I followed your advice from my previous question and now everything works, thanks.
    I have a question: looking in the controller I have not found how to plan the restart of the AP for example every day at a certain time or for example on Monday, Wednesday and Friday at 1:00 at night …
    I was wondering, why hasn’t a planned AP restart been expected when it is known that if for a certain period they are not restarted, they lose performance?
    I guess you have to do a cron with the reboot information … unfortunately I’m not very Linux expert, could you help me? Thanks

    • /* it is known that if for a certain period they are not restarted, they lose performance? */

      How is this known? This might have been true years ago, but there have been a lot of firmware updates, and I figure if I’m up to date I’m good. Plus I’ve never noticed the above effect. I’ve got clients with hundreds of days uptime and never heard this complaint, and my own systems never seem to be slowing over time…

      • Hi, sorry for the late reply. Yes I confirm you, I always update all devices (AP, USG, Switch etc.) to the latest firmware and yet if at least once a month (and often less) they do not restart, they lose their performance. I have an AP Mesh at home and if I don’t restart it at least once a week, I notice slowdowns and yet I have the fiber at 200Mbps: as soon as I restart the AP everything goes fast, this thing is frankly very stressful !!! I can think that I may have enabled some option that creates some problems, could you give me some advice or maybe post screen shots on how to best set up the wifi devices?
        In any case, could you help me plan the reboot of the devices? Unfortunately Ruud did not answer me. Thank you

          • Obviously I am talking about UniFi AC Mesh devices (not pro) and not about Mesh technology …

        • That said, I’ve used python and pexpect to ssh into a UniFi switch and power-cycle the PoE to a switch port, so you could probably use that to log into an AP and reboot it. There are a lot of moving parts, though (unless you want to assign static IPs you have to be able to find the network name of the AP, for instance), but it’ll run on the Pi that’s running the controller. Email hardware at compusmiths dot com for details, this discussion doesn’t really belong here…

  31. Hi, with these simple steps extract from Domoticz manual, i was solved the problem and both works. Regards.

    To start Domoticz automatically when the system starts perform the following steps:
    sudo cp domoticz.sh /etc/init.d
    sudo chmod +x /etc/init.d/domoticz.sh
    sudo update-rc.d domoticz.sh defaults

    Edit the startup script and change the USERNAME, DAEMON and DAEMON_ARGS parameters to reflect your current settingssudo

    vi /etc/init.d/domoticz.sh
    USERNAME=piDAEMON=/home/$USERNAME/domoticz/$NAMEDAEMON_ARGS=”-daemon -www 8080–sslwww 443″If you want to use another web interface port change:DAEMON_ARGS=”-daemon -www 8099–sslwww 443″

    sudo reboot

  32. ok, I finally got this working on my pi (which is still on Jessie, I need to upgrade…)

    When following this guide, java would fail to start with errors in /var/log/unifi/server.log like this:

    “`
    [2020-04-06T03:47:03,319] ERROR system – [exec] error, rc=141, cmdline=[
    /usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java, -Dfile.encoding=UTF-8, -Djava.aw
    t.headless=true, -Dapple.awt.UIElement=true, -Xmx1024M, -XX:+ExitOnOutOfMemoryEr
    ror, -XX:+CrashOnOutOfMemoryError, -XX:ErrorFile=/usr/lib/unifi/logs/hs_err_pid%
    p.log, -jar, /usr/lib/unifi/lib/ace.jar, start]
    “`

    I cobbled together that commandline (removing the commas) and ran it myself and saw the problem was the flags “-XX:+ExitOnOutOfMemoryError, -XX:+CrashOnOutOfMemoryError” – IIUC these were added in a later version of java8. If I manually removed these flags and ran the command it worked – so I knew it was at least possible.

    I tried installing oracle via the webupd8team repo but as noted elsewhere this is no longer possible due to a licensing change.

    So, my next step was trying to figure out how to get jsvc to stop passing those flags, but that completely escaped me. I debated writing a wrapper that would remove them and exec the real java, but was worried about unintended consequences (especially if I used a shell script). So, I called it a night.

    When I got up today I decided I’d just download JDK from Oracle manually, but then I thought I’d give openjdk one more try. I used the instructions here: https://qiita.com/PINTO/items/612718c0ce4f1def6c6e

    I had to remove “Release” from the sources.list line (deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ buster main Release). I also changed `buster` to `stretch` (oops, I forgot what version I was running, but it worked anyways). Then I was able to install that and had an updated java:

    “`
    java -version
    openjdk version “1.8.0_242″
    OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_242-b08)
    OpenJDK Zero VM (AdoptOpenJDK)(build 25.242-b08, interpreted mode)
    “`

    alas, the unifi init script doesn’t know where to find it. there are probably better fixes (maybe removing the old openjdk would work, since it does try to do something with `update-alternatives –query`) but I just hacked it so the new thing was the first thing it considered.

    “`
    # diff -u /etc/init.d/unifi.ORIG /etc/init.d/unifi
    — /etc/init.d/unifi.ORIG 2020-04-06 16:12:53.018115651 -0400
    +++ /etc/init.d/unifi 2020-04-06 15:44:34.621342131 -0400
    @@ -24,6 +24,7 @@
    support_java_ver=’8′
    java_list=”
    for v in ${support_java_ver}; do
    + java_list=`echo ${java_list} adoptopenjdk-$v-hotspot-${arch}`
    java_list=`echo ${java_list} java-$v-openjdk-${arch}`
    java_list=`echo ${java_list} java-$v-openjdk`
    done
    “`

    Then, I had some permissions problems with mongodb, which was probably a consequence of me running things manually as root earlier. I fixed it via some chowns found here: https://community.ui.com/questions/Problem-starting-Unifi-Controller/a4461d1e-f333-4cf3-b939-30246930b0c3

    “`
    sudo chown -R unifi:unifi /var/lib/unifi/data
    sudo chown -R unifi:unifi /usr/lib/unifi/data/db/
    sudo chown -R unifi:unifi /usr/lib/unifi
    “`

    I also had to `rm /var/log/unifi/mongod.log` since that was owned as root.

    Finally – success!

    • FYI, I upgraded my pi to buster via a full reinstall and was able to follow the instructions in my previous post without a problem (I didn’t have the permissions problems I described at the end, I must have messed those up when I was experimenting before). So, in summary:

      * install openjdk 1.8 following the instructions at https://qiita.com/PINTO/items/612718c0ce4f1def6c6e (except in step 3 I had to remove “Release” from the line you add to sources.list)
      * modify /etc/init.d/unifi to look for java in adoptopenjdk-$v-hotspot-${arch}
      – profit!

  33. Hello and thank you for the guide. I installed everything on my Pi3. I followed all the steps but when I started the wizard it didn’t recognize my AP Mesh. I used the controller on the computer, so I exported the site file and imported it into the Pi controller. The import was successful but I don’t understand why it doesn’t authenticate me, i.e. name or password not accepted (but they are the same that I use in the PC and they work there!). I also pressed on “Forgot password” but the email never comes to me …
    Could I know how to reset the password using telnet or editing a file? In Pi I can access it via ftp …
    If you can’t reset your password this way, can you tell me how to get back to the initial wizard? Thank you

    • Hi Roby,

      The username and password are not imported, you will need to login with the credentials that you create during the wizard. But if I understand you correctly, you didn’t follow the wizard to create one. So your only option is to reset the controller. You can either format the SD and start over (takes only 5 minutes 😉 ) or remove the files in Raspbian self through SSH:


      apt-get remove --purge unifi
      apt-get remove --purge mongodb
      rm -rf /usr/lib/unifi
      apt-get install unifi

  34. Great guide. Like to know if you have had a chance to upgrade the OS to Buster and where the update could be found?

  35. Excellent guide, worked flawlessly on my Pi 2b. I wish all technical guides were of this quality!

    thank you very much for sharing

    • Maybe don’t disable mongodb? Or install mongodb manually? Sorry I am not familiar with Pine 64. I know that Raspbian comes with its own mongodb, that way we disable it.

  36. Why are you stopping/disabling mongodb, I thought that database is what the controller uses as the backend for logs, storage etc.

    Could you clarify?

  37. And now to update the controller ? When Installed on a windows based system its only click on update, but on RB PI I’ve heard its not. Or is ?

  38. As said a great guide… All worked fine to do the installation

    Question I have is on the logging and the space it will take. Is there no way to use NFS and store the data in e.g. a NAS?

      • Hi Rudy,

        Great, but what will be moved? System.log file I guess but none of the files in the MongoDb? Here there will be a significant amount of data… still you can control this better in the GUI. But I have not a clue on how big thsi will become per AP so to say.

        /Anders

  39. Hi Rudy,

    Great tutorial!
    Just installed the Unifi Controller on an existing Raspberry pi 3 with domoticz already running.

    port 8443 didn’t work out.

    My fix:
    changed Domoticz port

    how to do this?
    log in to your pi with SSH or Putty

    pi@pi3:/etc/init.d $ sudo service domoticz stop
    pi@pi3:/etc/init.d $ sudo nano domoticz.sh

    change the line
    DAEMON_ARGS=”$DAEMON_ARGS -www 8080″
    to for example:
    DAEMON_ARGS=”$DAEMON_ARGS -www 8099″

    CTRL+X and save the file
    Please note:
    do not use a port in the range 8080 – 8088 as unifi also can use this port and will not start

    pi@pi3:/etc/init.d $ sudo service domoticz start
    Warning: domoticz.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.
    pi@pi3:/etc/init.d $ sudo systemctl daemon-reload
    pi@pi3:/etc/init.d $ sudo service domoticz start
    pi@pi3:/etc/init.d $ sudo service unifi status
    ● unifi.service – unifi
    Loaded: loaded (/lib/systemd/system/unifi.service; enabled; vendor preset: enabled)
    Active: inactive (dead) since Tue 2020-01-14 22:11:08 CET; 18min ago
    Main PID: 3306 (code=exited, status=0/SUCCESS)

    Jan 14 22:01:17 pi3 systemd[1]: Starting unifi…
    Jan 14 22:02:22 pi3 unifi.init[3248]: Starting Ubiquiti UniFi Controller: unifi failed!
    Jan 14 22:02:22 pi3 systemd[1]: Started unifi.
    Jan 14 22:11:06 pi3 systemd[1]: Stopping unifi…
    Jan 14 22:11:08 pi3 unifi.init[4280]: Stopping Ubiquiti UniFi Controller: unifi.
    Jan 14 22:11:08 pi3 systemd[1]: Stopped unifi.
    pi@pi3:/etc/init.d $ sudo service unifi start
    pi@pi3:/etc/init.d $ sudo service unifi status
    ● unifi.service – unifi
    Loaded: loaded (/lib/systemd/system/unifi.service; enabled; vendor preset: enabled)
    Active: active (running) since Tue 2020-01-14 22:30:56 CET; 11s ago

    Please note to use https://: to connect to the unifi controller in your web browser.
    In this example https://192.168.x.x:8099

  40. All,

    After some troubles, Domoticz frequently stopped working on my raspberry I have contacted Ubiquity support and they told me they stopped supporting th controller on a raspberry because of the troubles they have with the controller on a raspberry. So I deinstalled the controller from my raspberry and since then I did not had any trouble anymore with the my domoticz app on the raspberry. I now installed the controller on a NUC with ubuntu and that works fine and is fully supported by Ubiquity.

  41. Congrats – and thanks. Simplest cut paste for me to transfer my mac mini 2009 unifi controller to Raspberry Pi 4. Could not have gone smother!

  42. hello,

    On Dec 11 I ran the df -l command on my Pi controller
    and the /dev/root folder was in use 13%
    today the /dev/root folder was in use at 25% – only 15 days later.
    this is a 64GB memory card.

    I see that my server.log file I have 3 files there of about 100MB
    so even 300MB could not account for that % of the used space.

    mongod.log is 41MB as well.

    so, my question is how can I preserve my precious space, last time the disk was full, I had to reinstall.

    I have the controller to autobackup and only keep 7 files each aprox 15MB is about 110MB, new files replace old files, so this will not using the used space.
    Also set to data retention days to 7 days
    my log level is set to Normal (on device, mgmt, system remote access), which is lowest I could think off.

    Statistics data retention (set at minimum values)
    5 minutes set to 1 hour
    houly set to 1 day
    daily to 31 days
    monthly set to 90 days

    What does the option to “Compact Databse” will do ?

    I will like pointers or ideas on how to prevent the disk space to fill up, and thus I have to reinstall, or how to clean up
    originally I had a 32GB memory, I upgraded to 64GB, I have no plans to install a 128GB, and thus will end up upgrading to bigger and bigger, the idea is to contain the growth/use of space..

    thank you.

  43. Installed today, the tutorial is very easy! Installation went succesfull without warnings. However, it won’t run on the mentioned ports.

    The command service unifi status shows:

    unifi.service – unifi
    Loaded: loaded (/lib/systemd/system/unifi.service; enabled; vendor preset: enabled)
    Active: active (running) since Sun 2019-11-17 16:58:07 CET; 17s ago
    Process: 458 ExecStart=/usr/lib/unifi/bin/unifi.init start (code=exited, status=0/SUCCESS)
    Main PID: 581 (jsvc)
    Tasks: 23 (limit: 4915)
    CGroup: /system.slice/unifi.service
    ├─ 581 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-openjdk-armhf/jre/ -cp /usr/share/ja
    ├─ 582 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-openjdk-armhf/jre/ -cp /usr/share/ja
    ├─ 583 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-openjdk-armhf/jre/ -cp /usr/share/ja
    └─1671 /usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java -Dfile.encoding=UTF-8 -Djava.awt.headless

    Nov 17 16:56:36 raspberrypi systemd[1]: Starting unifi…
    Nov 17 16:58:07 raspberrypi unifi.init[458]: Starting Ubiquiti UniFi Controller: unifi failed!
    Nov 17 16:58:07 raspberrypi systemd[1]: Started unifi.

    The server isn’t running according to the command netstat -ntpl

    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN 1583/sendmail: MTA:
    tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 472/vncserver-x11-c
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 532/sshd
    tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1583/sendmail: MTA:
    tcp 0 0 0.0.0.0:2812 0.0.0.0:* LISTEN 470/monit
    tcp6 0 0 :::5900 :::* LISTEN 472/vncserver-x11-c
    tcp6 0 0 :::8080 :::* LISTEN 622/domoticz
    tcp6 0 0 :::22 :::* LISTEN 532/sshd
    tcp6 0 0 :::443 :::* LISTEN 622/domoticz
    tcp6 0 0 :::6144 :::* LISTEN 622/domoticz

    When I check system.properties I won’t see any occupied ports by domoticz:

    ## system.properties
    #
    # each unifi instance requires a set of ports:
    #
    ## device inform
    # unifi.http.port=8443
    ## controller UI / API
    # unifi.https.port=8443
    ## portal redirect port for HTTP
    # portal.http.port=8880
    ## portal redirect port for HTTPs
    # portal.https.port=8843
    ## local-bound port for DB server
    # unifi.db.port=27117
    ## UDP port used for STUN
    # unifi.stun.port=3478
    #
    ## the IP devices should be talking to for inform
    # system_ip=a.b.c.d
    ## disable mongodb journaling
    # unifi.db.nojournal=false
    ## extra mongod args
    # unifi.db.extraargs
    #
    ## HTTPS options
    # unifi.https.ciphers=TLS_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA
    # unifi.https.sslEnabledProtocols=TLSv1,SSLv2Hello
    # unifi.https.hsts=false
    # unifi.https.hsts.max_age=31536000
    # unifi.https.hsts.preload=false
    # unifi.https.hsts.subdomain=false
    #
    # Ports reserved for device redirector. There is no need to open
    # firewall for these ports on controller, however do NOT set
    # controller to use these ports.
    #
    # portal.redirector.port=8881
    # portal.redirector.port.wired=8882
    #
    # Port used for throughput measurement.
    # unifi.throughput.port=6789
    #
    #Sun Nov 17 15:30:58 UTC 2019
    debug.device=warn
    debug.mgmt=warn
    debug.sdn=warn
    debug.system=warn
    uuid=03579379-f9d7-4bcf-8239-6670315132e1

    Any help would be appreciated 🙂

  44. Just reinstalled my unifi controller. Followed the tutorial and worked like a charm. Hopefully I have no more issues with running out of disk space in a few months.

    Thank you 🙂

  45. Just followed this on my Pi2. UniFi would not start until I had run sudo apt-get install openjdk-8-jre

    I now have issues with backups not manually running which may be a permissions issues. I’m still working through that one and will report back.

  46. When I stop my domoticz service. I can access the controller page.
    Is it possible to run both on the same PI? Any one any ideas?

    • You will have to change to ports of the Unifi controller.

      Change the file: system.properties in the directory : /data/system.properties

      You can change it to 8081 and 8453 for example.

      • Rudy,

        Thanks indeed I managed to get it working. Changed the port to another because domoticz was already using 8080 on my PI and now I am able to reach the controler over the new port.

  47. Deaar Helpers,

    I followed the procedure completly. All worked but at the end when I try to connect with a browser from an other computer or even with a browser on the PI it self it tells me “connection refused”
    I am already on PI3.

    Here is the output of “sudo netstat -tlnp”:
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 865/smbd
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 558/sshd
    tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 865/smbd
    tcp6 0 0 :::139 :::* LISTEN 865/smbd
    tcp6 0 0 :::8080 :::* LISTEN 582/domoticz
    tcp6 0 0 :::22 :::* LISTEN 558/sshd
    tcp6 0 0 ::1:3350 :::* LISTEN 509/xrdp-sesman
    tcp6 0 0 :::14999 :::* LISTEN 582/domoticz
    tcp6 0 0 :::443 :::* LISTEN 582/domoticz
    tcp6 0 0 :::3389 :::* LISTEN 546/xrdp
    tcp6 0 0 :::445 :::* LISTEN 865/smbd

    What can I do / try to get it working?

  48. Hi Rudy,
    I will appreciate if you can share insides on how to keep the storage on the raspberri pi to a minimum or what to do periodically in order for the SD not to fill up.

    I used a 32GB SD card for the installation, and it filled it up in 4 months,
    now I used a 64GB card, but still don’t want to run into problems like before.

    somehow the controller gave a 500 server error, then when I freed some space, I could no longer authenticate any user, and ended up restarting from the begining with a backup.

    thank you

    • Hi Jimmy,

      Strange that your disk space if filling so rapidly, I never had an issue with that. How is your logo level set? (Maintenance > Services).
      You could try installing the following repo:

      sudo wget https://gist.githubusercontent.com/kburdett/006a16316afa62148b16/raw/unifi_logrotate.d.sh -O /etc/logrotate.d/unifi

      Or change the following file:
      /var/lib/unifi/system.properties

      and add the following line to it;
      log.inform=error

  49. I think I am getting an error due to lack of space.
    how can I clear the logs from putty / terminal ?
    with the pi user I get unathorized access….. what is the root password if we followed your instructions when we originally configured the pi ?
    thank you

      • How can I download the auto backup files on the SD card using putty or any other method
        When I SFtp to the SD card the data folder is a symlink and I cant see it to download

        I am unable to login to my controler, I can start from scratxh and upload a backup from the autobackup. Thank you

        • Hello,
          this is what I did…
          I logged in via SSH and switch to the “su” user, to change the ownership of all files to “pi”, then via SFTP I could download the auto update backups that were on the SD card on the /var/lib/unifi/data/backup/autobackup folder

          I did a clean install, and uploaded the latest recovered backup and was back in business.

          Thank you

  50. Hello, I used your instructions to set a raspberry PI 2 months ago, and it worked like a charm.
    today I tryed to login in, and for some reason, it did not recognized any of the 3 admin user/password setup. – the forgot password option did not work, as we did not received any email to reset the password.

    I did a hard reboot (disconnecting and reconnecting) and now I get
    500: Internal Server Error
    Please to get back to the homepage. (which loops back to the same error message)

    ideas please. I was going to do a backup today.

  51. Hi Ruud

    I’ve got a bit of a problem. I installed unifi controller following your tutorial about a year ago and recently I was getting spammed that my Pi3 is running low on disk space. Since I couldn’t find any solution to fix this I figured I would backup the config and reinstall. However I cannot seem to make it work. I followed the tutorial and when I do “service unifi status” is shows me this:

    unifi.service – unifi
    Loaded: loaded (/etc/systemd/system/unifi.service; enabled; vendor preset: en
    Active: failed (Result: start-limit-hit) since Sat 2019-10-26 20:29:49 BST; 2
    Process: 1055 ExecStop=/usr/lib/unifi/bin/unifi.init stop (code=exited, status
    Process: 947 ExecStart=/usr/lib/unifi/bin/unifi.init start (code=exited, statu

    Oct 26 20:29:49 raspberrypi systemd[1]: unifi.service: Service hold-off time ove
    Oct 26 20:29:49 raspberrypi systemd[1]: Stopped unifi.
    Oct 26 20:29:49 raspberrypi systemd[1]: unifi.service: Start request repeated to
    Oct 26 20:29:49 raspberrypi systemd[1]: Failed to start unifi.
    Oct 26 20:29:49 raspberrypi systemd[1]: unifi.service: Unit entered failed state
    Oct 26 20:29:49 raspberrypi systemd[1]: unifi.service: Failed with result ‘start

    • Most of the time is this error related to a missing or incorrect java version. I just formatted my Pi and re-installed it from step and everything is working great.
      Are you sure you installed OpenJDK?:

      sudo apt-get install openjdk-8-jre-headless -y

      • Yeah I am pretty sure.

        pi@raspberrypi:~ $ sudo apt-get install openjdk-8-jre-headless -y
        Reading package lists… Done
        Building dependency tree
        Reading state information… Done
        openjdk-8-jre-headless is already the newest version (8u232-b09-1~deb9u1).
        0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded.

        I will try and erase everything once again. The problem I only have TeamViewer access to the Pi and no physical access so I cannot really wipe it clean.

        I will do the “sudo dpkg -P unifi” and “sudo apt-get remove –purge oracle-java8-jdk openjdk-7-jre oracle-java7-jdk openjdk-8-jre” reboot and try again with your tutorial.

  52. From what i am reading this happened to others as well

    I installed controller per instructions and worked very well
    My problem came after first reboot its just stopped working and cant start the controller anymore.

    Is there something what i should do please i am lost !

  53. I tried leaving an update, not sure if it went through so here it is again (again):

    It looks like the pi is not listening on port 8443. Any idea why?

    pi@raspberrypi:~ $ sudo netstat -tlnp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 416/sshd
    tcp6 0 0 :::8880 :::* LISTEN 492/java
    tcp6 1 0 :::8080 :::* LISTEN 492/java
    tcp6 0 0 :::22 :::* LISTEN 416/sshd

    • I have sort of fixed it. I tried again on a RPi 3 instead of a RPi 2B and that works. My old 2B might simply not be powerful enough.

      Oh and sorry about the spam 😀

  54. Hey Rudy

    I started from scratch but I ran into the same problem as some of the others “This site can’t be reached 192.168.1.210 refused to connect” when trying to get to the Pi on the browser. I know the IP is correct as I can SSH into it. I have tried what you suggested to the others, but not luck.

    • UPDATE:
      I looks like the pi is not even listening on port 8443. Do you have any idea as to why?

      pi@raspberrypi:~ $ sudo netstat -tlnp
      Active Internet connections (only servers)
      Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
      tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 416/sshd
      tcp6 0 0 :::8880 :::* LISTEN 492/java
      tcp6 1 0 :::8080 :::* LISTEN 492/java
      tcp6 0 0 :::22 :::* LISTEN 416/sshd

    • UPDATE:
      It looks like the PI is not listening on port 8443. Any idea why?

      pi@raspberrypi:~ $ sudo netstat -tlnp
      Active Internet connections (only servers)
      Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
      tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 416/sshd
      tcp6 0 0 :::8880 :::* LISTEN 492/java
      tcp6 1 0 :::8080 :::* LISTEN 492/java
      tcp6 0 0 :::22 :::* LISTEN 416/sshd

  55. Thanks Rudy for this quick guide.
    I just used in to deploy it on my Pi2 (yes Second edition) and it works like a charm.
    Well, I just have 1 UAC AP and less than 20 devices but it is perfect !
    So thanks again !

    Just have a question, I’m not a Linux expert so could you please share the commands to do a clean shutdown of the environment (processes, databases…)

    Thanks !

  56. Hello there, thinking about buying ubiquiti AP, and ended up here, trying to save some bucks.

    What are the drawbacks to disabling mongoDB? Since ubititi states that “UniFi uses MongoDB to store relevant information about connected devices, Controller configuration, clients, and statistics.”

    Cant i set a limit to how many days the stats are kept? There must be somedrawbacks for sure, no?

  57. The instructions work great also on the new Raspberry Pi 4B, As per the August 22 2019 comment by AlwynAllan I skipped the “haveged” step. Indeed a ‘5 minute or less’ installation!

  58. Hey Guys,

    I am gun shy on this only because of SD card coruption. I know it doesn happen AS often like in the early days but still. Would love to build this, but using USB boot instead. I guess there is always berry boot. Anyone try this?

    • How about just sticking to the SD install, then image the SD card and do regular backups. I manually upload an encrypted version of my configuration to my Google drive. I’m planning on automating this process, but just haven’t had the time to do it.

  59. Worked great for me after my old setup choked on low disk space due to mongodb log files. I used 128 GB this time, but probably overkill.

    As of 2019 raspbian uses the Pi’s hardware RNG by default with rng-tools. I skipped “haveged” and have no slow startup problems. The command “$ xxd -p /dev/random” shows plenty of random entropy.

  60. When using (the earlier version of) this great guide a year ago on a Raspberry Pi, it indeed was a 5-minute affair and it worked flawlessly.
    Now that I wanted to install unifi on another Pi, I cannot get it to work. I followed all the steps on this page.

    When I check the status, unifi appears to be running:
    pi@raspberrypi:~ $ systemctl status unifi.service
    ● unifi.service – unifi
    Loaded: loaded (/lib/systemd/system/unifi.service; enabled)
    Active: active (running) since Mon 2019-08-19 21:11:37 UTC; 11min ago
    Process: 608 ExecStart=/usr/lib/unifi/bin/unifi.init start (code=exited, status=0/SUCCESS)
    Main PID: 888 (jsvc)

    When trying to access using https://….:8443 I get the error “Unable to connect”.
    Using “sudo netstat -ntpl” I do not see 8443 listed. I have port 8080 listed, which I use for another application. Even when I kill that application I cannot access the unifi web page.

    In the comments I read that the java version should be 8 or higher, reference is made to 1.8.1_201. I used the installation instructions for the JDK, the version information I get is:
    pi@raspberrypi:~ $ java -version
    openjdk version “1.8.0_40-internal”
    OpenJDK Runtime Environment (build 1.8.0_40-internal-b04)
    OpenJDK Zero VM (build 25.40-b08, interpreted mode)

    “40” sounds lower than “201”, could that be the issue? I looked at your page on how to update Java, but that instruction does not work anymore as the software apparently is not available anymore.

    “sudo cat /var/log/unifi/server.log” does not show anything, the log is empty.

    Any suggestions on what else I need to check or fix to make unifi function are appreciated!

    • The output f java -version should be similar:


      openjdk version "1.8.0_222"
      OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1~deb9u1-b10)
      OpenJDK Client VM (build 25.222-b10, mixed mode)

      Did you install OpenJDK with ? :
      sudo apt-get install openjdk-8-jre-headless -y

      • This is what I see:
        pi@raspberrypi:~ $ java -version
        openjdk version “1.8.0_40-internal”
        OpenJDK Runtime Environment (build 1.8.0_40-internal-b04)
        OpenJDK Zero VM (build 25.40-b08, interpreted mode)

        Yes, that is exactly the command I used to install OpenJDK.

        • Strange, try this;


          sudo apt clean
          sudo apt update

          Seems like you have an old version over OpenJDK, so the command

          sudo apt-get install openjdk-8-jre-headless -y

          Didn’t work as planned..

          • I have taken the below sequence of actions multiple times before the install of unifi and later the SDK:
            · pi@raspberrypi ~ $ sudo apt-get update
            · pi@raspberrypi ~ $ sudo apt-get upgrade -y
            · pi@raspberrypi ~ $ sudo apt-get clean
            · pi@raspberrypi ~ $ sudo reboot
            No luck it keeps installing SDK version 1.8.0_40.

          • I have downloaded openjdk version “1.8.0_222” from the web, and manually copied it to directory /usr/lib/jvm/java-8-openjdk-armhf. When I now request the version, it shows this build ‘222’.
            The unifi/server.log file shows a memory error, I have not figured out where this originates from. The log content is rather long:

            pi@raspberrypi:~ $ sudo cat /var/log/unifi/server.log
            [2019-08-21T21:38:54,369] WARN system – reload system.properties failed: file not found
            [2019-08-21T21:39:05,692] ERROR system – [exec] error, rc=1, cmdline=[/usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java, -Dfile.encoding=UTF-8, -Djava.awt.headless=true, -Dapple.awt.UIElement=true, -Xmx1024M, -XX:+ExitOnOutOfMemoryError, -XX:+CrashOnOutOfMemoryError, -XX:ErrorFile=/usr/lib/unifi/logs/hs_err_pid%p.log, -jar, /usr/lib/unifi/lib/ace.jar, start]

            Earlier I had a problem with the tmpfs file system being full, purged that so that now at least the log file can show content. I don’t know yet where this memory error stated in the log would originate from…

          • @Rudy @Bram

            Unfortunately the same problem for me. I’m also stuck on the .40 version.

            @Bram, is the manual update working?

            When I look at this feedback it seems that unifi is working…but I can’t reach the interface
            >>>
            systemctl status unifi.service
            ● unifi.service – unifi
            Loaded: loaded (/lib/systemd/system/unifi.service; enabled)
            Active: active (running) since Mwk 2019-08-28 11:08:24 CEST; 15min ago
            Process: 639 ExecStart=/usr/lib/unifi/bin/unifi.init start (code=exited, status=0/SUCCESS)
            Main PID: 855 (jsvc)
            CGroup: /system.slice/unifi.service
            ├─855 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-openjdk-armhf -cp /usr/share/…
            ├─856 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-openjdk-armhf -cp /usr/share/…
            └─857 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-openjdk-armhf -cp /usr/share/…
            >>>

          • @Ralf: The copy action appears to load the proper Java version. The unifi service shows to be running. However, the listed warning and errors indicate still something else is wrong. I have not sorted that out yet, will attempt a complete new install later (for now I took a spare Pi to get unifi running on this network).
            Try ‘sudo netstat -ntpl’ to see if Port 8443 is actually listening (in my case it is NOT).
            Also, to see what the full output is, use ‘systemctl status unifi.service –full’, it likely shows further on in the output lines what error it is in your case. That out to give you a hint where else to look.

  61. Hi Ruud,
    I am wanting to give this a go. But how do i know what version of the controller it will install?
    Or does it just pick the latest available form Ubiquiti?

    Clive.

  62. Hi !
    I have follow this tuto but it seems’s that it not work for me….
    When I try to connect on my ip for the raspberry, i have a message that tells me “CONNECITON REFUSED”.
    Can you help me ?

  63. … a year later …

    need to add a comment, unifi will only run on JDK 8, Oracle or OpenJDK. so add a line to the installation script

    sudo apt-get install openjdk-8-jre

    for Buster from July 123 2019 and later….

  64. From various topics got a headache without working results. With this clear explanation you will like the PI again, it works great.
    Thanks,
    Mathijs.

  65. Works great on Buster too! Many thanks for this, I was pulling my hair out trying to follow other tutorials.

  66. Indeed 5 minutes up and running on 3b+ works flawless.
    Enough capacity to handle 2x us8 switch 4x ap 1x security gateway

    Thanks a lot!

  67. Hi,
    I have this issue:
    [2019-05-30T19:28:27,479] INFO system – *** Running for the first time, creating identity ***
    [2019-05-30T19:28:27,484] INFO system – UUID: 47ec6880-4d41-4f5d-a6b3-da3c4a0299fe
    [2019-05-30T19:28:27,497] WARN system – reload system.properties failed: file not found
    [2019-05-30T19:28:27,609] INFO system – ======================================================================
    [2019-05-30T19:28:27,618] INFO system – UniFi 5.10.23 (build atag_5.10.23_11668 – release) is started
    [2019-05-30T19:28:27,620] INFO system – ======================================================================
    [2019-05-30T19:28:27,634] INFO system – BASE dir:/usr/lib/unifi
    [2019-05-30T19:28:28,316] INFO system – Current System IP: 192.168.11.26
    [2019-05-30T19:28:28,319] INFO system – Hostname: irrighino
    [2019-05-30T19:28:32,510] INFO system – Valid keystore is missing. Generating one …
    [2019-05-30T19:28:32,541] INFO system – Generating Certificate[UniFi]… please wait…
    root@irrighino:~# tail -f /var/log/unifi/server.log
    [2019-05-30T19:28:27,497] WARN system – reload system.properties failed: file not found
    [2019-05-30T19:28:27,609] INFO system – ======================================================================
    [2019-05-30T19:28:27,618] INFO system – UniFi 5.10.23 (build atag_5.10.23_11668 – release) is started
    [2019-05-30T19:28:27,620] INFO system – ======================================================================
    [2019-05-30T19:28:27,634] INFO system – BASE dir:/usr/lib/unifi
    [2019-05-30T19:28:28,316] INFO system – Current System IP: 192.168.11.26
    [2019-05-30T19:28:28,319] INFO system – Hostname: irrighino
    [2019-05-30T19:28:32,510] INFO system – Valid keystore is missing. Generating one …
    [2019-05-30T19:28:32,541] INFO system – Generating Certificate[UniFi]… please wait…
    [2019-05-30T19:30:18,342] ERROR system – [exec] error, rc=255, cmdline=[/usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java, -Dfile.encoding=UTF-8, -Djava.awt.headless=true, -Dapple.awt.UIElement=true, -Xmx1024M, -XX:+ExitOnOutOfMemoryError, -XX:+CrashOnOutOfMemoryError, -XX:ErrorFile=/usr/lib/unifi/logs/hs_err_pid%p.log, -jar, /usr/lib/unifi/lib/ace.jar, start]
    [2019-05-30T19:30:49,796] ERROR system – [exec] error, rc=255, cmdline=[/usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java, -Dfile.encoding=UTF-8, -Djava.awt.headless=true, -Dapple.awt.UIElement=true, -Xmx1024M, -XX:+ExitOnOutOfMemoryError, -XX:+CrashOnOutOfMemoryError, -XX:ErrorFile=/usr/lib/unifi/logs/hs_err_pid%p.log, -jar, /usr/lib/unifi/lib/ace.jar, start]

    Anyone can help me?

      • I have resolved.
        The issue was about the 8080 port that was occupied by another web server on my raspberry.
        I changed the port and the provisioning was completed successfully.

  68. Hi, I followed all your steps but getting an error when installing the controller.

    It looks like the following (version numbers can be different):

    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:3.6.0) | mongodb-10gen (<< 3.6.0) | mongodb-org-server (<< 3.6.0); however:
    Package mongodb-server is not installed.
    Package mongodb-10gen is not installed.
    Package mongodb-org-server is not installed.

    Any idea?

  69. Very great article, Thank you!
    That is what i am looking for.
    Can I access Raspberry Pi unifi-controller from anywhere?
    We have setup “wifi network” in rural area of Myanmar/Burma.

  70. Great write up. I used it this afternoon to set up my new home Unifi network.
    I saw someone mention that a Raspberry Pi 3 may be needed. I loaded up a model 2. Will I run into any issues? I only have 1 AP and 2 switches.

    • Hi Greg,

      You can use a Raspberry Pi Model 2 without any problems. The amount of devices and clients determine the required processing power and RAM needed. A model 2 can handle one AP and two switches without any issues.

      • So if I were to upgrade to a Model 3, would I just be able to pull the SD card from the Model 2 and have it work without any problems? Or would I be better off rebuilding the whole thing and restoring the database?

  71. I was getting ready to order the Pi but noticed the hardware requirements for Unify Controller changed. Most notable, the 2GB RAM requirement. Is getting the Pi 3 B+ with 1GB RAM still sufficient for running the controller? Thanks!

  72. I followed the guide, but it seems like nothing listens on port 8443. I have octoprint (https://octoprint.org/) running on port 80, and that works fine.

    Assuming this is the correct way to check the status:
    – systemctl status unifi.service

    It looks like the Unifi controller does not start, but there is no indication as to why it fails.
    =====================================
    ● unifi.service – unifi
    Loaded: loaded (/lib/systemd/system/unifi.service; enabled; vendor preset: enabled)
    Active: active (running) since Mon 2019-04-01 14:48:26 BST; 1min 16s ago
    Process: 556 ExecStart=/usr/lib/unifi/bin/unifi.init start (code=exited, status=0/SUCCESS)
    Main PID: 605 (jsvc)
    CGroup: /system.slice/unifi.service
    ├─605 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt -cp /usr/share/java/commons-daemon.jar:/usr/lib/unifi/lib/ace.jar -pidfile /var/run/unifi.pid -procname unifi -outfile SYSLOG -errfile $
    ├─606 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt -cp /usr/share/java/commons-daemon.jar:/usr/lib/unifi/lib/ace.jar -pidfile /var/run/unifi.pid -procname unifi -outfile SYSLOG -errfile $
    └─607 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt -cp /usr/share/java/commons-daemon.jar:/usr/lib/unifi/lib/ace.jar -pidfile /var/run/unifi.pid -procname unifi -outfile SYSLOG -errfile $

    Apr 01 14:47:13 octopi systemd[1]: Starting unifi…
    Apr 01 14:48:26 octopi unifi.init[556]: Starting Ubiquiti UniFi Controller: unifi failed!
    Apr 01 14:48:26 octopi systemd[1]: Started unifi.
    =====================================

    I am not so experienced with PI and Raspian yet, so the above is what I have managed to find on different forums, and may be completely wrong.

    Can you guide me 2 how I can troubleshoot my installation?

      • First of all, thanks for the quick reply 🙂

        I rebooted to get the startinfoThe log indicates that initialization goes alright, and then it goes into an error, which repeats every 15 seconds – but not with much information.

        [2019-04-01T21:17:02,881] INFO system – ======================================================================
        [2019-04-01T21:17:02,906] INFO system – UniFi 5.10.20 (build atag_5.10.20_11657 – release) is started
        [2019-04-01T21:17:02,906] INFO system – ======================================================================
        [2019-04-01T21:17:02,912] INFO system – BASE dir:/usr/lib/unifi
        [2019-04-01T21:17:03,082] INFO system – Current System IP: 192.168.1.90
        [2019-04-01T21:17:03,083] INFO system – Hostname: octopi
        [2019-04-01T21:17:09,381] INFO db – waiting for db connection…
        [2019-04-01T21:17:09,888] INFO db – Connecting to mongodb://127.0.0.1:27117
        [2019-04-01T21:17:17,177] INFO db – Connecting to mongodb://127.0.0.1:27117
        [2019-04-01T21:17:17,246] INFO stat – *** Factory Default *** Stat Database exists. Clean it
        [2019-04-01T21:17:17,329] INFO stat – *** Factory Default *** Stat Database exists. Drop it
        [2019-04-01T21:17:20,179] INFO webrtc – WebRTC library version: EvoStream Media Server (www.evostream.com) build v2.2.2 – Gladiator – (built for Debian-8.2.0-armhf on 2018-12-15T00:37:36.000) OpenSSL version: 1.0.2n usrsctp $
        [2019-04-01T21:18:07,338] ERROR system – [exec] error, rc=255, cmdline=[/usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java, -Dfile.encoding=UTF-8, -Djava.awt.headless=true, -Dapple.awt.UIElement=true, -Xmx1024M, -XX:+ExitOnOutOfMemoryError, -XX:+CrashOnOutOfMemoryError, -XX:ErrorFile=/usr/lib/unifi/logs/hs_err_pid%p.log, -jar, /usr/lib/unifi/lib/ace.jar, start]

        I examined /usr/lib/unifi/logs/ which is a link to /var/log/unifi for a detailed error-file, but this directory only contains the server.log and mongod.log.

        An observation from the mongod.log is that it actually shuts down shortly after unifi calls it – is that supposed to be happen. I would expect mongod to be running at all times? (tail on the mongod.log file below).

        Mon Apr 1 21:17:20.566 [conn1] end connection 127.0.0.1:59998 (3 connections now open)
        Mon Apr 1 21:17:22.492 [initandlisten] connection accepted from 127.0.0.1:60006 #5 (1 connection now open)
        Mon Apr 1 21:17:22.497 [conn5] terminating, shutdown command received
        Mon Apr 1 21:17:22.497 dbexit: shutdown called
        Mon Apr 1 21:17:22.497 [conn5] shutdown: going to close listening sockets…
        Mon Apr 1 21:17:22.497 [conn5] closing listening socket: 7
        Mon Apr 1 21:17:22.497 [conn5] closing listening socket: 8
        Mon Apr 1 21:17:22.497 [conn5] removing socket file: /usr/lib/unifi/run/mongodb-27117.sock
        Mon Apr 1 21:17:22.497 [conn5] shutdown: going to flush diaglog…
        Mon Apr 1 21:17:22.497 [conn5] shutdown: going to close sockets…
        Mon Apr 1 21:17:22.497 [conn5] shutdown: waiting for fs preallocator…
        Mon Apr 1 21:17:22.497 [conn5] shutdown: closing all files…
        Mon Apr 1 21:17:22.503 [conn5] closeAllFiles() finished
        Mon Apr 1 21:17:22.503 [conn5] shutdown: removing fs lock…
        Mon Apr 1 21:17:22.503 dbexit: really exiting now

        • UniFi controller will start its own MongoDB instance on the non-standard port, so it looks ok. Only your first log ends with ExitOnOutOfMemoryError, -XX:+CrashOnOutOfMemoryError,. Isn’t it a simple memory related issue? You can check the memory usage with the cmd free -h

          • Thanks for helping me out! Your kind replies sent me in the right direction and forced me to pick up stuff learned many years ago, and almost forgotten. If someone else, is in the same situation as me, the least i can do is share what I did.

            I am running it on a Pi 3 Model B+ with 1 GB RAM – and “free -h”tells me there should 685 MB free, so I should be ok here.

            I was pretty sure – although java coding lies 15+ years back – that -XX:+CrashOnOutOfMemoryError is just a parameter for the jvm, but comment from you sent me on the next step. Just run the command manually and see what happens.

            I took out the command from log file and executed it in the “sudo -i” mode

            /usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java, -Dfile.encoding=UTF-8, -Djava.awt.headless=true, -Dapple.awt.UIElement=true, -Xmx1024M, -XX:+ExitOnOutOfMemoryError, -XX:+CrashOnOutOfMemoryError, -XX:ErrorFile=/usr/lib/unifi/logs/hs_err_pid%p.log, -jar, /usr/lib/unifi/lib/ace.jar, start -bash: /usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java,: No such file or directory

            I then removed the commas between the parameters (they might just be introduced by the logging code) and there was a hit.
            /usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java -Dfile.encoding=UTF-8 -Djava.awt.headless=true -Dapple.awt.UIElement=true -Xmx1024M -XX:+ExitOnOutOfMemoryError -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/usr/lib/unifi/logs/hs_err_pid%p.log -jar /usr/lib/unifi/lib/ace.jar start
            Port 8080 not available

            Examining what was running on port netstat -nlp | grep 8080 revealed some streamer was running:
            tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 440/./mjpg_streamer

            So i edited /var/lib/unifi/system.properties and changed the port, and now it is running.

            So thanks a lot for the help!

  73. Thank you so much for this write up & reply. You made it so much easier to install Unifi. What are your thoughts of going into raspi-config & adjusting the memory split to 16MB.

  74. I am confused. If using openjdk instead of Oracle Java, in your last command to install UniFi you are also installing Oracle java when you installed openjdk earlier. I thought it was one or the other not both?

    • I understand something has gone wrong with updating the article last week. So Step 3 (now there are 4 main steps 😉 ) was still the old part of the article contains the old Java version. I am sorry for the inconvenience! The article is now completely updated. Just formatted my Raspberry Pi again and tested every step to make sure everything is right.

  75. Hi again,
    Nope… it was not a port issue. Service refuses to start…

    pi@raspberrypi:~ $ systemctl status unifi.service
    ● unifi.service – unifi
    Loaded: loaded (/lib/systemd/system/unifi.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Tue 2019-03-26 20:32:10 GMT; 29s ago
    Process: 674 ExecStart=/usr/lib/unifi/bin/unifi.init start (code=exited, status=1/FAILURE)

    Mar 26 20:32:09 raspberrypi systemd[1]: unifi.service: Control process exited, code=exited status=1
    Mar 26 20:32:09 raspberrypi systemd[1]: Failed to start unifi.
    Mar 26 20:32:09 raspberrypi systemd[1]: unifi.service: Unit entered failed state.
    Mar 26 20:32:09 raspberrypi systemd[1]: unifi.service: Failed with result ‘exit-code’.
    Mar 26 20:32:10 raspberrypi systemd[1]: unifi.service: Service hold-off time over, scheduling restart.
    Mar 26 20:32:10 raspberrypi systemd[1]: Stopped unifi.
    Mar 26 20:32:10 raspberrypi systemd[1]: unifi.service: Start request repeated too quickly.
    Mar 26 20:32:10 raspberrypi systemd[1]: Failed to start unifi.
    Mar 26 20:32:10 raspberrypi systemd[1]: unifi.service: Unit entered failed state.
    Mar 26 20:32:10 raspberrypi systemd[1]: unifi.service: Failed with result ‘exit-code’.

    Have been trying a lot of stuff but nothing seems to work…..

    Thanks!

  76. Rudy – please ignore my previous comment; I am such a fool – a simple clearing of my DNS cache on my Mac sufficed…! How stupid 🙂

  77. Hi Rudy
    This is the easiest of all guides I’ve found to get the Unifi controller working on a Pi; however, as others have noted I cannot get my web browser to open a page as expected.

    Indeed I can happily SSH into the IP address for the Pi, but trying to access it via https:// will not work, I am merely presented with “This site can’t be reached 10.0.0.102 refused to connect.”

    I have updated Java as per your additional comment, but still the same problem exists.

    Any ideas?

    Raspberry Pi3 with Stretch

  78. I get “ERR_CONNECTION_REFUSED” in the browser when trying to connect. I also have VNC running on the Pi – don’t know if that might cause a conflict somewhere….

  79. Just a note to those using these instructions – they worked brilliantly the first time, but when I came to upgrade Unifi Controller versions I ran into two issues. First, the java version was out of date and the new version just failed to start and I had to follow the instructions here to update the JDK:

    Guide to update Java also here on LazyAdmin

    I also had an issue where restoring a backup configuration didn’t work. Looking at the logs it seemed that it wanted to use mongodb to do some of the database migration, but these instructions disabled it. I re-enabled it and repeated the process with success.

    Hope that helps someone.

  80. Very nice tutorial, thank you. It worked perfectly on my older Pi 2.
    One error :
    on #4, you have
    sudo apt-get update sudo apt-get install unifi oracle-java8-jdk -y
    it should be
    sudo apt-get update && sudo apt-get install unifi oracle-java8-jdk -y

  81. Errors during installation:

    apt-get update
    ….
    Err http://www.ubnt.com stable/ubiquiti armhf Packages
    301 Moved Permanently [IP: 52.89.117.13 80]
    Ign http://www.ubnt.com stable/ubiquiti Translation-en
    W: Failed to fetch http://www.ubnt.com/downloads/unifi/debian/dists/stable/ubiquiti/binary-armhf/Packages 301
    Moved Permanently [IP: 52.89.117.13 80]

    E: Some index files failed to download. They have been ignored, or old ones used instead.

    and

    apt-get install unifi
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package unifi

  82. Note, default Oracle JRE is 8u65….should probably just forget the oracle JDK in the article.
    {{{
    sudo apt-get install openjdk-8-jre-headless
    }}}

  83. I have the same problem as James.

    I have followed all of the instructions but, when I go to the final stage of viewing this in the browser it shows nothing (I know that the pi is there on the ip address as I can putty into it).

    unifi is already the newest version (5.10.17-11638-1).
    oracle-java8-jdk is already the newest version (8u65).

    What could be the problem?

  84. Rudy,

    You posted on 12th Feb
    “You can follow this guide to update Java on the Raspberry Pi”

    There was nothing to follow.
    Can you re-post what version of java we need to make this work with the latest version of Unifi controller?

    Great article.

    Leo

  85. First of all, I wanted to say “Thank you so much for this”.
    I have used this guide in the past and it worked flawlessly. However, today I am having some difficulties. I have followed all of the instructions (to the best of my knowledge – I am not a command line person!) and everything seems to go well, however, when I go to the final stage of viewing this in the browser it shows nothing (I know that the pi is there on the ip address as I can putty into it). It is like the unifi software is not running on the pi or something similar.
    Any help gratefully received.

    • Hi James,

      I was able to reproduce your issue. It’s related to the new controller version, 5.10.12. I will come with an upgrade guide and solution later to today.

      • Hi Rudy,

        thank you for this. I will have time to start from the beginning at the weekend. I did quickly try (I had to install vim as for some reason I did not have this already working – could this have worked with tee?) but did not have the time to start from scratch. I really do appreciate your time on this (as I really don’t want to have to buy a cloud key!). If I run into any more issues I hope it will be ok to post them here.

        James

      • Rudy,

        thank you for your help. I started from scratch and followed all of the instructions but I have run up against “This site can’t be reached 192.168.1.2 refused to connect” when trying to get to the Pi on the browser. I wonder if there is something stopping me browse to the pi (when I can SSH to it if needed)?

        James

  86. I have followed så many guides to install Unifi controller on Raspberry. They all work, but the controller allways stops working after some time. Needs to be restartet daily. After some time its completely broken and you need to start all over reinstalling everything. I have done this fve times now 🙁

    I guess Raspberry Pi cant handle this?

  87. Thanks a bunch, really useful guide you have there, especially for someone thats new to the command line like me.

    However, I did encounter an error whereby I was not able to update after adding the key. Error message as below:

    pi@raspberrypi:~ $ sudo apt-get update
    Hit:1 http://archive.raspberrypi.org/debian stretch InRelease
    Hit:2 http://raspbian.raspberrypi.org/raspbian stretch InRelease
    Get:3 http://www.unbt.com/downloads/unifi/debian stable InRelease
    Err:3 http://www.unbt.com/downloads/unifi/debian stable InRelease
    Clearsigned file isn’t valid, got ‘NOSPLIT’ (does the network require authentication?)
    Fetched 59 B in 1s (29 B/s)
    Reading package lists… Done
    E: Failed to fetch http://www.unbt.com/downloads/unifi/debian/dists/stable/InRelease Clearsigned file isn’t valid, got ‘NOSPLIT’ (does the network require authentication?)
    E: Some index files failed to download. They have been ignored, or old ones used instead.

    Any idea how to go about this?
    Thanks again!

  88. You can simplify installation somewhat and avoid cluttering up your Pi with openjdk by rearranging the command order:

    echo ‘deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti’ | sudo tee -a /etc/apt/sources.list.d/100-ubnt.list > /dev/null
    sudo apt-get -y install dirmngr
    sudo apt-key adv –keyserver keyserver.ubuntu.com –recv 06E85760C0A52C50
    sudo apt-get update
    sudo apt-get install unifi oracle-java8-jdk -y
    sudo systemctl stop mongodb
    sudo systemctl disable mongodb
    sudo reboot

    Apt happily resolves the dependencies of the unifi package and allows installation without grabbing the full openjdk package.

  89. Is it possible to install the Unifi Video controller software as well into the PI along side the Unifi controller software?

  90. Brilliant article thank you!!! Worked perfect first time and saved me alot of typing (by using SSH putty paste) and alot of possible hassle since I am no Linux pro whatsoever (I am an IT Windows guy). I did a for more updates and upgrades than in your article just because but also your command to update the firmware – brilliant.

  91. Thanks for sharing. I followed all the steps and everything seems going fine up to the last step, except that when I go the IP address of the Raspberry, port 8443, it shows a blank page and there’s an error logged in the browser console:

    Uncaught Error: [$injector:modulerr] Failed to instantiate module app-unifi-wizard due to:

    Error: [$injector:nomod] Module ‘app-unifi-wizard’ is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

    Never had a similar issue?

    • In this case I would just reboot and run the install and update steps again. Just to be sure you have the latest versions.

      First try update only:
      sudo apt-get update && sudo apt-get upgrade -y

      Run the install again:
      sudo apt-get install unifi -y

      Of nothing works, then format the SD and start over.

          • Just updating and installing didin’t work, I repeated all the steps except for the initial ones, as I directly flashed a Raspbian Lite image to the SSD (instead of using NOOBS). It initially gave me the same error, but after a few minutes it worked fine, showing the wizard. I’m not sure if it could have worked even the first time, if I only had waited a few more minutes.

  92. I agree great guide. Easy to follow. Thanks a lot.

    Just one thing: to enable SSH in raspi-config you have to go to “Interfacing Options” not “Advanced Options”.

    And don’t forget to do updates!

  93. Great guide. It was quick and easy to copy and paste from instead of having to figure out everything yourself

Leave a Comment

229 Shares
Tweet
Pin229
Share
Share