Home Install UniFi Controller on CentOS 7
Post
Cancel

Install UniFi Controller on CentOS 7

This is a short simple guide to assist users with installing the Ubiquiti UniFi Controller required for all UniFi devices on a CentOS 7 Server.

First we need to update our CentOS server and disable SELinux:

1
2
3
yum -y update
sed -i /etc/selinux/config -r -e 's/^SELINUX=.*/SELINUX=disabled/g'
systemctl reboot

You don’t need to disable SELinux however may experience issues if it isn’t setup correctly.

Now we need to make sure we have EPEL Repo:

1
yum -y install epel-release

Install services required by the Controller:

1
yum -y install mongodb-server java-1.8.0-openjdk unzip wget

Create our service user account:

1
useradd -r ubnt -s /sbin/nologin

We put the -s /sbin/nologin so that this user cannot be logged in as a user, only the service will be able to use this account.

Download and extract the UniFi Controller software:

1
2
3
cd ~ && wget http://dl.ubnt.com/unifi/5.3.11/UniFi.unix.zip
unzip -q UniFi.unix.zip -d /opt
chown -R ubnt:ubnt /opt/UniFi

At the time of writing the latest version was v5.3.11, change the version number in the download link to the latest version.

Create a startup script for use with Systemd:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# Systemd unit file for UniFi Controller
#

[Unit]
Description=UniFi 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

Configure Firewalld:

1
systemctl stop firewalld.service
1
2
3
4
5
6
7
8
9
10
11
12
<?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>

Once the firewall rules xml file is created we need to add this to our firewall zones, the default zone will be public but you should know for your firewall.

1
2
systemctl start firewalld.service
firewall-cmd --permanent --zone=public --add-service=unifi

Enable the service to run when the server boots:

1
systemctl enable unifi.service

Remove the zip and reboot the server:

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

Once the server is back online you should be able to access the controller via the URL: https://FQDN\_or\_IP:8443 Follow the simple wizard to complete the setup of your controller, I would also recommend you register with Ubiquiti when you setup the controller, this will allow you to manage it remotely on a mobile device.

Credit to: https://deviantengineer.com

This post is licensed under CC BY 4.0 by the author.

Install FreeRadius on CentOS 7 with DaloRadius for management – Updated

Setup Ubiquiti UniFi USG Remote User VPN