Skip to content

Instantly share code, notes, and snippets.

@deergod1
Last active January 20, 2023 20:00
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deergod1/2acedcd1220d5c45c70082165fb05207 to your computer and use it in GitHub Desktop.
Save deergod1/2acedcd1220d5c45c70082165fb05207 to your computer and use it in GitHub Desktop.
Install Unifi Controller on an Old PC with Debian Ubuntu

Install Unifi Controller on an Old PC with Debian Ubuntu

No More Cloud Key for Me

After several months of dealing with these notices in my inbox, I have decided to move away from the Unifi Cloud Key.

[UniFi] Alert: UniFi Prune Database Failed
Alarm
UniFi
UniFi Alarm: Prune Database Failed
Message: The database is 269 MB. Removing old records was unable to free an adequate amount of space. 
         It may be necessary to modify data retention settings.
Controller URL: https://192.168.1.x:8443/manage/site/super

There are several guides for manually pruning MongoDB, but it was a royal pain, far from foolproof, and mostly prevents me from storing even a reasonable amount of history about my network.

HP t620 Thin Client to the Rescue Again

I used an HP t620 Thin Client acquired on eBay for less than $50 US. With only a single ethernet port, it's still more than enough for the Unifi Network Controller.

7 Steps to Ubuntu and 7 More to Unifi

I tried installing Ubuntu Server several times, but just couldn't get the last few steps to click. The desktop version is larger, but has the GUI and seems much more forgiving... at least it has a UI. Here's what I did:

First, backup your configuration from the Cloud Key. Just leave all the history behind and get the Settings Only. Trust me.

Settings / Maintenance / Backup / Backup Data Retention

From one of your other computers in the house from the Unfi Controller web page:

  • Select Settings Only - Download Backup

Installing Ubuntu

Downloaded Ubuntu 18.04.2 LTS (Bionic Beaver) Desktop Image from 64-bit PC (AMD64) desktop image. The file name is ubuntu-18.04.2-desktop-amd64.iso.

Use Rufus to format and create bootable USB flash drives, memory sticks, etc.

I recommend resetting the BIOS to the defaults, and THEN go back and set these:

  • After Power Loss: Power ON
  • Make sure the SSD is set as the first drive to boot.

I only boot from USB when explicitly needed (as in step 2 below).

  1. Connect only the monitor, keyboard, ethernet cable, and Ubuntu USB drive/ISO.
  2. Power on and press BIOS/boot options key (Esc then F9 on my HP t620, frequently F10 on other PCs).
  3. Boot to the USB stick (labeled UEFI PMAP USB on my machine).
  4. Install Ubuntu using the Minimal default options. Just follow the prompts.
  5. Set your name, username, and password to something safe and strong you will remember.
  6. When the install is finished, remove the USB Stick. If you set the BIOS right, you may never need to look at this PC again.
  7. From now on, login via SSL from another computer on the same network. I like Putty.

Then, just follow Glenn's instructions EXACTLY.

GLENNR / UNIFI INSTALLATION SCRIPTS

1. Copy the link location of the script.
2. SSH into your Ubuntu/Debian machine, and login as root. ( Ubuntu | sudo -i  |  Debian | su )
2a. Make sure the ca-certificates package is installed.
    apt-get install ca-certificates -y
3. Download the script by executing the following command. ( change it to your wanted version )
    wget https://get.glennr.nl/unifi/5.10.20/U1604/unifi-5.10.20.sh
4. Make the script executable ( change it to the script version you downloaded )
    chmod +x unifi-5.10.20.sh
5. After you downloaded the script and made it executable you need to run it, by executing the following command.
    ./unifi-5.10.20.sh
6. Once the installation is completed browse to your controller.
    https://ip.of.your.server:8443
7. Kudo Glenn's post (seriously, register, and do it).

Background on UniFi Installation Scripts | UniFi Easy Update Scripts

GlennR/AmazedMender16 seems to keep these scripts always up to date, but in case I need it later, here's what I used:

Installation script for UniFi 5.10.23 - Ubuntu 18.04 ( Mint 19 )

Script removed -- just pull it from glennr.nl during the install (step 3 above).

That is literally all. I just left the install running when it finished and the Unifi controller came right up.

If you are having trouble, remember you must use https:// (with the s), and you must use the corrent IP, and the right port. Glenn shows you in the script what to type. So hard to screw it up.

For me it was a simple restore from there. Changing the IP address of the controller is an exercise for the reader (and better done in your firewall).

Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment