Ubiquiti UniFi Controller in an Debian LXC Container
I wanted to avoid adding MongoDB and a bunch of Java to existing VMs, so installing Ubiquiti UniFi Controller in an Debian LXC Container was the perfect option!
Ubiquiti UniFi Controller in an Debian LXC Container
I’m still fairly new to Ubiquiti’s wireless access points, but I’ve been a hardcore DD-WRT user for many many years. All my wifi router purchases were always verified on the DD-WRT compatibility list, prior to making a selection.
I did have a 3 year hiatus, using an Apple Airport Extreme, due to the 2.4GHz congestion in my subdivision. 5GHz was wide open spaces!
A few months ago, I ditched my Mac workstations, moving to Debian, and found myself in a pickle, when it was time to modify the Airport’s config or upgrade the software.
Where do I go from here? Do I look around to find a 5GHz router that support DD-WRT or try something new? I’ve heard good things about the Ubiquiti’s wireless access points in many conversations with my younger brother and via internet research.
I decided to take the plunge and ordered a Dual Radio PRO Wireless Access Point (UAP-AC-PRO). Install was quick and painless and the resulting wireless has been fast and rock solid!
The only caveat was figuring out where to install the UniFi Controller Software, the server that “controls” your Ubiquiti products, in this case, my Unifi access point. For the initial setup, I ran the Windows version on a VM, that I was currently using for another lab. Being Windows doesn’t sit well with me, not that I’m a anti-Windows guy, but I prefer Linux (obviously).
This week, I migrated my 2 ESXi servers to Proxmox (qemu/KVM), which support LXC containers. Since I am late to the container game, this was a great opportunity to test out an Debian LXC container.
I grabbed the Debian Container image from http://download.proxmox.com/images/system/ and imported it into Proxmox.
Proxmox makes container deployment uber simple. Click the “Create CT” button and walk through the wizard. It lets you select the template, configure the disk space, network settings and more, which is a great time saver over the command line method.
One note on the template, Unifi Controller uses MongoDB, which needs at least 4GB of free space for “journalling”, which caused Unifi to not start properly the first few times. The default container disk space is 8GB. I threw 20GB of thin provisioned space at it and everything went smoothly after that.
In addition to the MongoDB, the Unifi Controller requires Java, so keeping this stuff containerized is a great option.
Log into the Unif Controller container via console or SSH and add the the correct repository. I was using version 5.X so unifi5 was the repo for me, to allow me to import my backup from the Windows Lab VM. Find other repositories here https://help.ubnt.com/hc/en-us/articles/220066768-UniFi-How-to-Install-Update-via-APT-on-Debian-or-Ubuntu#STEPS
Edit /etc/apt/sources.list
deb http://www.ubnt.com/downloads/unifi/debian unifi5 ubiquiti
Add the GPG key:
# retrieve the latest package information
# install/upgrade unifi-controller
All that remains now is to log into Unifi Controller
https://IPADDRESS:8443 and import your backup, or reconfigure from scratch.
Troubleshooting and log files here:
/usr/lib/unifi/logs/server.log
/usr/lib/unifi/logs/mongod.log
Unifi Access Point Migration to New Controller
If you are migrating from another controller, select the ‘Forget This AP‘ in the old Unifi Controller software and then unplug the AP’s power to reset it. Then you should be able to adopt it from the new controller. Now I can manage my wireless access point, from a dedicated container!
Filed under: Configs,Hardware,Uncategorized - @ April 21, 2017 7:21 pm
Tags: container, debian, LXC, proxmox, ubiquiti, unifi, Unifi Controller
Thank you for the simple walk-through! This worked great, aside from adding the GPG key. I did the following after editing the sources.list file:
# gpg –keyserver keyserver.ubuntu.com –recv-key 06E85760C0A52C50
# gpg -a –export 06E85760C0A52C50 | apt-key add –
After that all steps were the same.
Glad it worked, thanks for the info on the GPG key!
5.7 needs a new repo:
echo ‘deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti’ | tee /etc/apt/sources.list.d/100-ubnt-unifi.list
Key:
wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ubnt.com/unifi/unifi-repo.gpg
Source:
https://help.ubnt.com/hc/en-us/articles/220066768-UniFi-How-to-Install-Update-via-APT-on-Debian-or-Ubuntu