22A Hue Street, Hanoi, Vietnam 0904092014 info@binhminhitc.com

This guide will show you how to install the Unifi Controller on the CentOS server to allow you to set a central portal for managing either single or multiple sites of unifi devices.

Let’s Get Started.

 

1. Install CentOS

ISO can be obtained from the internet for free and works on Hyper V or ESX (any potentially others)

2. Update CentOS

Updating CentOS is a simple command using Yum. You just want to make sure that CentOS is up to date before its gets off the ground running.

root@techshare.vn [~]# yu update -y

3. Install prerequisites

root@techshare.vn [~]#yum -y install epel-release
root@techshare.vn [~]# yum -y install mongodb-server java-1.8.0-openjdk unzip wget
root@techshare.vn [~]#systemctl start mongod
root@techshare.vn [~]#systemctl enable mongod
root@techshare.vn [~]#sed -i /etc/selinux/config -r -e 's/^SELINUX=.*/SELINUX=disabled/g'
root@techshare.vn [~]#systemctl reboot

4. Download and Extract the Unifi Controller (latest version can be found on unifi website)

root@techshare.vn [~]#useradd -r ubnt
root@techshare.vn [~]#cd ~ && wget http://dl.ubnt.com/unifi/5.6.30/UniFi.unix.zip
root@techshare.vn [~]#unzip -q UniFi.unix.zip -d /opt
root@techshare.vn [~]#chown -R ubnt:ubnt /opt/UniFi

5. Create Startup Script with Systemd

vi /etc/systemd/system/unifi.service
---
#
# Systemd unit file for UniFi Controller
#
[Unit]
Description=UniFi AP Web Controller
After=syslog.target network.target
[Service]
Type=simple
User=ubnt
WorkingDirectory=/opt/UniFi
ExecStart=/usr/bin/java -Xmx1024M -jar /opt/UniFi/lib/ace.jar start
ExecStop=/usr/bin/java -jar /opt/UniFi/lib/ace.jar stop
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
---

6. Configure Firewalld

systemctl stop firewalld.service
vi /etc/firewalld/services/unifi.xml
---
<?xml version="1.0" encoding="utf-8"?>
<service version="1.0">
<short>unifi</short>
<description>UniFi Controller</description>
<port port="8081" protocol="tcp"/>
<port port="8080" protocol="tcp"/>
<port port="8443" protocol="tcp"/>
<port port="8880" protocol="tcp"/>
<port port="8843" protocol="tcp"/>
<port port="10001" protocol="udp"/>
<port port="3478" protocol="udp"/>
</service>
---

systemctl start firewalld.service
firewall-cmd --set-default-zone=home # You can use one of the other zones, if you like. I prefer using home instead of the default "public", just adjust accordingly below.
firewall-cmd --permanent --zone=home --change-interface=eth0 # I only have one active interface on my UniFi server, eth0. This should be the interface that UniFi will be using.
firewall-cmd --permanent --zone=home --add-service=unifi

7. Enable on Startup

systemctl enable unifi.service

8. And to finish CLEANUP

rm -rf ~/UniFi.unix.zip
systemctl reboot

9. To access the webUI

Bbrowse to https://IP_OF_SERVER:8443 and follow the simple setup wizard. This is a simple step by step and if you follow exactly what was written your Unifi Server will work without issue. Hope you enjoyed, and please contact  if you have any feedback!