Migrating a Ubiquiti Unifi Controller to Run on a Raspberry Pi for Pennies
Are you a fan of Ubiquiti gear, but would rather have your controller running on a Raspberry Pi? Here's a simple walkthrough to configure everything.
Join the DZone community and get the full member experience.
Join For Freeubiquiti wi-fi gear is becoming well-known as the go-to brand for nerds wanting to have home wi-fi that competes with commercial setups. the ubiquiti ac-pro access points, in particular, are in the category of “next level” consumer gear, and after installing them i’ve never looked back. being commercial gear the ubiquiti aps do have one annoying requirement: you need to run controller software on your network to monitor and control the access points through ubiquiti’s cloud-based controller software. luckily you can run this software on a range of hardware – and a $35 raspberry pi is just the ticket.
when i first setup my ubiquiti access points i set up a virtualbox host on my home server to run the ubiquiti controller software on ubuntu. this has been a nice way of running the software without paying $79 for a ubiquiti unifi cloud key, but it does mean you’ve got to run an extra host whenever you’re administering your access points.
a raspberry pi is an awesome replacement for a virtual machine and isn’t as pricey as a cloud key. geeking out aside, another bonus is that you can also run other stuff on your raspberry pi at the same time when you’re done.
prerequisites
the migrate a controller host onto a raspberry pi you’ll need a few things first.
- raspberry pi – $35
- samsung 32gb sd card – $12.99
- sb components case – $4.99
setting up the raspberry pi
the first thing you’ll want to do is download the latest version of raspbian from the raspberry pi site:
next, you can download software to flash raspbian onto your ssd:
run this, and flash it onto your new ssd
configuring raspberry pi
plug in your raspberry pi and start it up.
connect to your local network or wifi and fire up a terminal session to update the os.
sudo apt-get updatesudo apt-get upgrade
now we’re ready to setup the ubiquiti software.
installing the ubiquiti software
first, we need to add the unifi package list to the raspberry pi.
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 wget -o /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ubnt.com/unifi/unifi-repo.gpg
sudo apt-get update
now what we need to install is the oracle java8 runtime, along with the ubiquiti software. ubiquiti really only needs the jdk, so if you install just the jdk at the same time as the ubiquiti controller software, apt-get will figure out that you don’t need the full java runtime.
again in the terminal, type the following;
sudo apt-get install unifi oracle-java8-jdk –y
finally, when installing the unifi controller software, you might notice in the screenshot above you also end up installing mongodb. we don’t want that running on your nice clean (and resource constrained) raspberry pi. so let’s disable this from starting at boot time. the unifi controller software runs it’s own instance of mongo when it starts up, so you don’t need this running as well.
sudo systemctl disable mongodb
sudo systemctl stop mongodb
now let's login to the controller via the local host on the machine.
setting up the new controller and migrating
the unifi cloud control software works in a pretty cool way. basically, it watches your network for devices, and then reports these back to the cloud-based unifi service. this means you can then control your home network from the cloud without needing to punch holes in your firewall.
first off, visit your raspberry pi’s controller software by visiting the unifi software’s port.
my raspberry pi has taken up the ip address of 192.168.1.198 so i’m going to visit it from another machine on the network on the tcp post 8443
i’m using chrome, which throws a security warning, as the default ubiquiti controller software doesn’t have a commercial ssl certificate attached. select to proceed .
you’ll then be asked to set up the controller’s backup and timezone settings.
then skip through the device setup screens as they’ll be no devices for adoption (they’re all already managed).
next, you can set up an access point for your new unifi access controller site (we’ll overwrite this later).
now configure your administrator access credentials.
confirm everything on your new controller’s configuration.
now the ubiquiti software asks you to login to your ubnt account so it can add the new raspberry pi controller to your account.
now that you’ve logged in, your new raspberry pi controller can be accessed at any time from https://unifi.ubnt.com – nice!
now we’ve got to migrate your current access points over the new controller.
migrating unifi access points
the next step is you’ve got to migrate the access points you have today to the new raspberry pi controller.
firstly we want to export the site from the current controller. login to the current (soon to be deprecated) controller and open up the settings screen for the site you want to migrate (the one that has the access points in it).
in the bottom of the site settings screen, you’ll notice an “export site” button. press this and save the file locally.
now in a separate tab login to your new controller and visit the “sites” screen. we’re going to import the site into your raspberry pi controller.
give the new site you’re importing a name.
now shift back to your old controller’s tab and finish migrating the access points to your new controller by entering your new controller’s ip address.
in the next screen, you’ll want to forget the devices on your old controller.
and that’s it, you’re now done! your raspberry pi is now acting as a controller for your unifi network.
Published at DZone with permission of Douglas Rathbone, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments