Upgrade Your Linux UniFi Controller Version in 5 Minutes 5

UPDATE: I’ve written an automated script that performs all the steps in this article in less than 60 seconds. Feel free to follow the steps below if you want full manual control, or download my script to make your life even easier. 🙂

Ubiquiti Networks’ Java-based UniFi Controller software has a native .deb package available for Debian and Ubuntu users, but if you’re running CentOS or some other Linux flavor, you’ll have to use UBNT’s generic Unix controller package. Don’t worry, it’s very easy to upgrade.

I previously explained how to install your own cloud-based or hosted controller on CentOS in this article. Once you have it up and running on your system, it’s even easier to upgrade to a newer version. The entire process takes less than 5 minutes with the following steps.

(I’ve confirmed these steps moving from UniFi Controller 4.x to 5.0.x, as well as between various release candidate versions, i.e. 5.0.1 to 5.0.4, etc.)

Stop the existing UniFi Controller service:

# service UniFi stop

Download the latest version of the generic Unix/Linux UniFi Controller software to your /tmp directory:

# cd /tmp
# wget https://www.ubnt.com/downloads/unifi/5.0.x-xxxxxxx/UniFi.unix.zip -O UniFi.unix.zip

(using the -O flag will overwrite any previous version that happens to be in the /tmp directory, and prevent wget from renaming it)

Remove any previous backups you’ve made from prior upgrades (you could alternatively rename them):

# rm -rf /opt/UniFi_bak

Rename your current installation directory:

# mv /opt/UniFi /opt/UniFi_bak

Unzip the newer version of the UniFi Controller software you just downloaded into the /opt directory (it will create a new subdirectory called /opt/UniFi):

# unzip /tmp/UniFi.unix.zip -d /opt

Change into the old directory:

# cd UniFi_bak

Copy the existing configuration and historical data into a compressed tar file into the /tmp directory:

# tar zcvf /tmp/unifi_data_bak.tar.gz data/

Change into the new directory:

# cd /opt/UniFi

Uncompress the backup data tarball into the new directory:

# tar zxvf /tmp/unifi_data_bak.tar.gz -C /opt/UniFi

Set the proper ownership for the ubnt user/group:

chown -R ubnt:ubnt /opt/UniFi

Restart the UniFi Controller service:

# service UniFi start

Log in to your new controller, and optionally upgrade any newly available UniFi device firmware that came bundled with the updated controller.

Congratulations! You just updated your UniFi Controller.