wiki:UniFiControllerCentOS6

Install Ubiquiti Networks UniFi Controller on CentOS 6

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

# uname -nri
hamster 2.6.32-696.16.1.el6.x86_64 x86_64
#
  1. Download, install MongoDB 2.4.14 server package. No need to start the server.
# url=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/RPMS
# wget $url/mongo-10gen-2.4.14-mongodb_1.x86_64.rpm
# wget $url/mongo-10gen-server-2.4.14-mongodb_1.x86_64.rpm
# rpm -i mongo-10gen*-2.4.14-mongodb_1.x86_64.rpm
# chkconfig mongod off
#
  1. Install Java 1.8 JDK.
# yum install java-1.8.0-openjdk
 [...]
Complete!
#
# rpm -qa --last |head -7
java-1.8.0-openjdk-1.8.0.151-1.b12.el6_9.x86_64 Tue 26 Dec 2017 07:25:03 PM PST
xorg-x11-fonts-Type1-7.2-11.el6.noarch        Tue 26 Dec 2017 07:25:01 PM PST
ttmkfdir-3.0.9-32.1.el6.x86_64                Tue 26 Dec 2017 07:25:01 PM PST
java-1.8.0-openjdk-headless-1.8.0.151-1.b12.el6_9.x86_64 Tue 26 Dec 2017 07:25:00 PM PST
xorg-x11-font-utils-7.2-11.el6.x86_64         Tue 26 Dec 2017 07:24:53 PM PST
libXfont-1.5.1-2.el6.x86_64                   Tue 26 Dec 2017 07:24:53 PM PST
libfontenc-1.1.2-3.el6.x86_64                 Tue 26 Dec 2017 07:24:53 PM PST
#
# which java
/usr/bin/java
# java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
#
  1. Download UniFi software from the Ubiquiti Networks web site @ http://dl.ubnt.com/unifi/5.6.26/UniFi.unix.zip
  1. Create a shell user that will be used to run the daemon (instead of root).
# groupadd -r unifi
# useradd -r -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.26
# ln -s UniFi-5.6.26 /opt/UniFi
#
  1. Create a run-control script.
# vi /etc/rc.d/init.d/unifi
# chmod 755 /etc/rc.d/init.d/unifi
#
# pr -to3 /etc/rc.d/init.d/unifi 
   #!/bin/sh
   #
   # unifi This shell script takes care of starting and stopping
   #       Ubiquiti Networks UniFi Controller
   #
   # chkconfig: - 84 16
   # description: Ubiquiti Networks UniFi Controller for Linux
   #
   
   PROG=`basename $0 .sh`
   LOCKFILE=/var/lock/subsys/$PROG
   
   UNIFI_USER=unifi
   UNIFI_HOME=/opt/UniFi
   
   start() {
     echo $"Starting Ubiquiti Networks UniFi Controller: "
     /bin/su - $UNIFI_USER -c "(cd $UNIFI_HOME ; java -Xmx1024M -jar lib/ace.jar start)" &
     RETVAL=$?
     [ $RETVAL -eq 0 ] && touch $LOCKFILE
     return $RETVAL
   }
   
   stop() {
     echo $"Stopping Ubiquiti Networks UniFi Controller: "
     /bin/su - $UNIFI_USER -c "(cd $UNIFI_HOME ; java -jar lib/ace.jar stop)"
     RETVAL=$?
     [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
     return $RETVAL
   }
   
   # See how we were called.
   case "$1" in
     start)
       start
       ;;
     stop)
       stop
       ;;
     *)
       echo $"Usage: $PROG {start|stop}"
       exit 2
   esac
   
   exit $?
   
   ### End-Of-File
#
# chkconfig --add unifi
# chkconfig unifi on
# chkconfig --list unifi
unifi          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
#
  1. Start the daemon. About half a minute later check the processes running.
# service unifi start
Starting Ubiquiti Networks UniFi Controller: 
#
# sleep 30
# ps -ef |grep unifi |grep -v grep
root      9165     1  0 20:26 pts/3    00:00:00 /bin/su - unifi -c (cd /opt/UniFi ; java -Xmx1024M -jar lib/ace.jar start)
unifi     9167  9165  0 20:26 ?        00:00:00 -bash -c (cd /opt/UniFi ; java -Xmx1024M -jar lib/ace.jar start)
unifi     9176  9167  0 20:26 ?        00:00:00 -bash -c (cd /opt/UniFi ; java -Xmx1024M -jar lib/ace.jar start)
unifi     9177  9176  2 20:26 ?        00:02:04 java -Xmx1024M -jar lib/ace.jar start
unifi    10013  9177  0 20:26 ?        00:00:42 bin/mongod --dbpath /opt/UniFi-5.6.26/data/db --port 27117 --unixSocketPrefix /opt/UniFi-5.6.26/run --logappend --logpath /opt/UniFi-5.6.26/logs/mongod.log --nohttpinterface --bind_ip 127.0.0.1
#
  1. Check the TCP ports in use.
# netstat -tanp | egrep 'PID|LISTEN.*java'
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:6789                0.0.0.0:*                   LISTEN      9177/java           
tcp        0      0 0.0.0.0:8843                0.0.0.0:*                   LISTEN      9177/java           
tcp        0      0 0.0.0.0:8880                0.0.0.0:*                   LISTEN      9177/java           
tcp        0      0 0.0.0.0:8080                0.0.0.0:*                   LISTEN      9177/java           
tcp        0      0 0.0.0.0:8443                0.0.0.0:*                   LISTEN      9177/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      10013/bin/mongod    
#
  1. Connect to the UniFi controller in a web browser. Perform initial configuration, then adopt your UniFi AP(s).

See Also

https://community.ubnt.com/t5/UniFi-Updates-Blog/UniFi-5-6-26-Stable-has-been-released/ba-p/2165432
UniFi 5.6.26 Stable has been released

Last modified 7 years ago Last modified on Dec 27, 2017 6:23:59 AM