wiki:UniFiControllerCentOS7

Install Ubiquiti Networks UniFi Controller on CentOS 7

The following installation was performed on a EL7.x86_64 server.

# uname -nri
gerbil 3.10.0-957.5.1.el7.x86_64 x86_64
#
  1. Download, install MongoDB 3.4.19 server package. No need to start the server.
# url=https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.4/x86_64/RPMS
# wget -q $url/mongodb-org-server-3.4.19-1.el7.x86_64.rpm
# ls -l mongo*
-rw-r--r-- 1 root root 20978433 Jan 22 15:31 mongodb-org-server-3.4.19-1.el7.x86_64.rpm
#
# yum localinstall mongodb-org-server-3.4.19-1.el7.x86_64.rpm
 [...]
Installed:
  mongodb-org-server.x86_64 0:3.4.19-1.el7

Complete!
#
# systemctl status mongod.service
● mongod.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: https://docs.mongodb.org/manual
#
# systemctl disable mongod.service
Removed symlink /etc/systemd/system/multi-user.target.wants/mongod.service.
#
  1. Install Java 1.8 JDK.
# yum install java-1.8.0-openjdk
 [...]
Installed:
  java-1.8.0-openjdk.x86_64 1:1.8.0.191.b12-1.el7_6

Dependency Installed:
  copy-jdk-configs.noarch 0:3.3-10.el7_5
  dejavu-fonts-common.noarch 0:2.33-6.el7
  dejavu-sans-fonts.noarch 0:2.33-6.el7
  fontconfig.x86_64 0:2.13.0-4.3.el7
  fontpackages-filesystem.noarch 0:1.44-8.el7
  giflib.x86_64 0:4.1.6-9.el7
  java-1.8.0-openjdk-headless.x86_64 1:1.8.0.191.b12-1.el7_6
  javapackages-tools.noarch 0:3.4.1-11.el7
  libICE.x86_64 0:1.0.9-9.el7
  libSM.x86_64 0:1.2.2-2.el7
  libX11.x86_64 0:1.6.5-2.el7
  libX11-common.noarch 0:1.6.5-2.el7
  libXau.x86_64 0:1.0.8-2.1.el7
  libXcomposite.x86_64 0:0.4.4-4.1.el7
  libXext.x86_64 0:1.3.3-3.el7
  libXi.x86_64 0:1.7.9-1.el7
  libXrender.x86_64 0:0.9.10-1.el7
  libXtst.x86_64 0:1.2.3-1.el7
  libfontenc.x86_64 0:1.1.3-3.el7
  libjpeg-turbo.x86_64 0:1.2.90-6.el7
  libxcb.x86_64 0:1.13-1.el7
  libxslt.x86_64 0:1.1.28-5.el7
  lksctp-tools.x86_64 0:1.0.17-2.el7
  python-javapackages.noarch 0:3.4.1-11.el7
  python-lxml.x86_64 0:3.2.1-4.el7
  ttmkfdir.x86_64 0:3.0.9-42.el7
  tzdata-java.noarch 0:2018i-1.el7
  xorg-x11-font-utils.x86_64 1:7.5-21.el7
  xorg-x11-fonts-Type1.noarch 0:7.5-9.el7

Complete!
#
# java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
#
  1. Download UniFi software from the Ubiquiti Networks web site @ http://dl.ubnt.com/unifi/5.6.40/UniFi.unix.zip
# wget -q http://dl.ubnt.com/unifi/5.6.40/UniFi.unix.zip
# ls -l UniFi*
-rw-r--r-- 1 root root 63584069 Aug 30 13:10 UniFi.unix.zip
#
  1. Create a shell user that will be used to run the daemon (instead of root).
# groupadd -g 144 unifi
# useradd -u 144 -g unifi -c UniFi -M -d /opt/UniFi -s /bin/bash unifi
#
  1. Unpack the UniFi software, assign an owner.
# unzip -q UniFi.unix.zip -d /opt
# chown -R unifi.unifi /opt/UniFi
#
# mv /opt/UniFi /opt/UniFi-5.6.40
# ln -s UniFi-5.6.40 /opt/UniFi
#
  1. Create a Systemd unit file.
# vi /opt/UniFi/bin/unifi.service
# pr -to3 /opt/UniFi/bin/unifi.service
   #
   # Systemd unit file for UniFi Controller
   #

   [Unit]
   Description=UniFi Controller
   After=network.target

   [Service]
   Type=simple
   User=unifi
   Group=unifi
   WorkingDirectory=/opt/UniFi
   ExecStart=/usr/bin/java -Xmx1024M -jar lib/ace.jar start
   ExecStop=/usr/bin/java -jar lib/ace.jar stop
   SuccessExitStatus=143

   [Install]
   WantedBy=multi-user.target
#
# ln -s /opt/UniFi/bin/unifi.service /lib/systemd/system/
#
# systemctl status unifi.service
● unifi.service - UniFi Controller
   Loaded: loaded (/opt/UniFi/bin/unifi.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
#
# systemctl enable unifi.service
Created symlink from /etc/systemd/system/multi-user.target.wants/unifi.service to /opt/UniFi/bin/unifi.service.
Created symlink from /etc/systemd/system/unifi.service to /opt/UniFi/bin/unifi.service.
#
  1. Start the daemon. About half a minute later check the processes running.
# systemctl start unifi.service
#
# systemctl status unifi.service
● unifi.service - UniFi Controller
   Loaded: loaded (/opt/UniFi/bin/unifi.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-02-27 15:24:08 PST; 6s ago
 Main PID: 5927 (java)
   CGroup: /system.slice/unifi.service
           └─5927 /usr/bin/java -Xmx1024M -jar lib/ace.jar start

Feb 27 15:24:08 gerbil systemd[1]: Started UniFi Controller.
#
# systemctl status unifi.service
● unifi.service - UniFi Controller
   Loaded: loaded (/opt/UniFi/bin/unifi.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-02-27 15:24:08 PST; 3min 9s ago
 Main PID: 5927 (java)
   CGroup: /system.slice/unifi.service
           ├─5927 /usr/bin/java -Xmx1024M -jar lib/ace.jar start
           └─6761 bin/mongod --dbpath /opt/UniFi-5.6.40/data/db --port 27117 --unixSocketPrefix /opt/UniFi-5.6.40/run --logappend --logpath /opt/UniFi-5.6.40/logs/mongod.log --nohttpinterface --bind_ip 127.0.0.1

Feb 27 15:24:08 gerbil systemd[1]: Started UniFi Controller.
#
#
# ls -l /opt/UniFi/logs/
total 48
-rw-r--r-- 1 unifi unifi 42092 Feb 27 15:27 mongod.log
-rw-r--r-- 1 unifi unifi  1413 Feb 27 15:27 server.log
#
# cat /opt/UniFi/logs/server.log
[2019-02-27 15:24:13,940] <launcher> INFO  system - ======================================================================
[2019-02-27 15:24:13,944] <launcher> INFO  system - UniFi 5.6.40 (build atag_5.6.40_10370 - release) is started
[2019-02-27 15:24:13,944] <launcher> INFO  system - ======================================================================
[2019-02-27 15:24:13,956] <launcher> INFO  system - BASE dir:/opt/UniFi-5.6.40
[2019-02-27 15:24:13,994] <launcher> INFO  system - Current System IP: 192.168.228.109
[2019-02-27 15:24:13,999] <launcher> INFO  system - Hostname: gerbil
[2019-02-27 15:24:19,368] <launcher> INFO  db     - waiting for db connection...
[2019-02-27 15:24:19,870] <launcher> INFO  db     - Connecting to mongodb://127.0.0.1:27117
[2019-02-27 15:24:26,374] <launcher> INFO  db     - Connecting to mongodb://127.0.0.1:27117
[2019-02-27 15:24:27,123] <launcher> INFO  webrtc - WebRTC library version: EvoStream Media Server (www.evostream.com) build v1.0.31 - Gladiator - (built for Debian-7.0.5-x86_64 on 2018-02-01T22:48:38.000) OpenSSL version: 1.0.2l usrsctp version: 6d79bcc19755bc08 compiled on machine: Linux debian-7-0-5-64 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u6 x86_64 GNU/Linux
#
# tail -2 /opt/UniFi/logs/mongod.log
2019-02-27T15:24:26.714-0800 I INDEX    [conn4] build index done.  scanned 0 total records. 0 secs
2019-02-27T15:24:37.502-0800 I NETWORK  [thread1] connection accepted from 127.0.0.1:37014 #5 (5 connections now open)
#
#
# ps -ef |egrep 'unifi|java|mongo' |grep -v grep
unifi     5927     1  9 15:24 ?        00:00:34 /usr/bin/java -Xmx1024M -jar lib/ace.jar start
unifi     6761  5927  2 15:24 ?        00:00:05 bin/mongod --dbpath /opt/UniFi-5.6.40/data/db --port 27117 --unixSocketPrefix /opt/UniFi-5.6.40/run --logappend --logpath /opt/UniFi-5.6.40/logs/mongod.log --nohttpinterface --bind_ip 127.0.0.1
#
  1. Check the TCP/UDP ports in use.
# netstat -tanp | egrep 'PID|LISTEN.*java'
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp6       0      0 :::8843                 :::*                    LISTEN      5927/java
tcp6       0      0 :::8880                 :::*                    LISTEN      5927/java
tcp6       0      0 :::8080                 :::*                    LISTEN      5927/java
tcp6       0      0 :::8443                 :::*                    LISTEN      5927/java
tcp6       0      0 :::6789                 :::*                    LISTEN      5927/java
#
# netstat -uanp | egrep 'PID|java'
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
udp6       0      0 :::3478                 :::*                                5927/java
udp6       0      0 192.168.228.109:55017   :::*                                5927/java
udp6       0      0 :::10001                :::*                                5927/java
#
# netstat -tanp | egrep 'PID|LISTEN.*mongod'
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:27117         0.0.0.0:*               LISTEN      6761/bin/mongod
#
  1. Create firewall openings.
# systemctl stop firewalld.service
#
# vi /etc/firewalld/services/unifi.xml
# pr -to3 /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="8080" protocol="tcp"/>
       <port port="8443" protocol="tcp"/>
       <port port="8880" protocol="tcp"/>
       <port port="8843" protocol="tcp"/>
       <port port="6789" protocol="tcp"/>
   </service>
#
# systemctl start firewalld.service
#
# firewall-cmd --permanent --add-service=unifi
success
#
# firewall-cmd --reload
success
#
# firewall-cmd --list-services
ssh dhcpv6-client unifi
#
# firewall-cmd --list-all
public
  target: default
  icmp-block-inversion: no
  interfaces:
  sources:
  services: ssh dhcpv6-client unifi
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

#
  1. Connect to the UniFi controller in a web browser. Perform initial configuration, then adopt your UniFi AP(s).

See Also

https://unifi-forum.nl/onderwerpen/unifi-sdn-controller-5-6-40-lts-stable-has-been-released.286/
UniFi SDN Controller 5.6.40 LTS Stable has been released

Last modified 7 years ago Last modified on Mar 1, 2019, 12:00:00 AM
Note: See TracWiki for help on using the wiki.