wiki:UniFiControllerCentOS5
Last modified 6 years ago Last modified on 09/01/13 04:22:59

Install Ubiquiti Networks UniFi Controller on CentOS 5

The following installation was performed on a EL5.i386 server.

# uname -nri
hamster 2.6.18-348.4.1.el5 i386
#
  1. Download, install MongoDB server package. No need to start the server.
# url=http://downloads-distro.mongodb.org/repo/redhat/os/i686/RPMS
# wget -q $url/mongo18-10gen-1.8.4-mongodb_1.i686.rpm
# wget -q $url/mongo18-10gen-server-1.8.4-mongodb_1.i686.rpm
# rpm -i mongo18-10gen*
# chkconfig mongod off
#
  1. Install Java 1.6 JDK.
# yum install java-1.6.0-openjdk
 [...]
Installed:
  java-1.6.0-openjdk.i386 1:1.6.0.0-1.40.1.11.11.el5_9                                                             

Dependency Installed:
  alsa-lib.i386 0:1.0.17-1.el5
  giflib.i386 0:4.1.3-7.3.3.el5
  jpackage-utils.noarch 0:1.7.3-1jpp.3.el5    
  libXtst.i386 0:1.0.1-3.1
  tzdata-java.i386 0:2013b-1.el5    

Complete!
#
# which java
/usr/bin/java
# java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.11) (rhel-1.40.1.11.11.el5_9-i386)
OpenJDK Client VM (build 20.0-b12, mixed mode)
#
  1. Download UniFi software from the Ubiquiti Networks web site @ http://www.ubnt.com/eula/?BACK=/downloads/unifi/2.3.9/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-2.3.9
# ln -s UniFi-2.3.9 /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 -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      6614  6360  0 14:05 pts/2    00:00:00 su - unifi -c (cd /opt/UniFi ; java -jar lib/ace.jar start)
unifi     6615  6614  0 14:05 ?        00:00:00 -bash -c (cd /opt/UniFi ; java -jar lib/ace.jar start)
unifi     6635  6615  0 14:05 ?        00:00:00 -bash -c (cd /opt/UniFi ; java -jar lib/ace.jar start)
unifi     6636  6635 48 14:05 ?        00:00:29 java -jar lib/ace.jar start
unifi     6658  6636  4 14:05 ?        00:00:01 bin/mongod --dbpath /opt/UniFi-2.3.9/data/db --port 27117 --logappend --logpath logs/mongod.log --nohttpinterface --bind_ip 127.0.0.1
#
  1. Check the TCP ports in use.
# netstat -tanp | egrep 'PID|java'
Proto Recv-Q Send-Q Local Address          Foreign Address        State       PID/Program name   
tcp        0      0 0.0.0.0:8843           0.0.0.0:*              LISTEN      6636/java           
tcp        0      0 0.0.0.0:8880           0.0.0.0:*              LISTEN      6636/java           
tcp        0      0 0.0.0.0:8080           0.0.0.0:*              LISTEN      6636/java           
tcp        0      0 127.0.0.1:8081         0.0.0.0:*              LISTEN      6636/java           
tcp        0      0 0.0.0.0:8443           0.0.0.0:*              LISTEN      6636/java           
tcp        0      0 127.0.0.1:54890        127.0.0.1:27117        ESTABLISHED 6636/java           
tcp        0      0 127.0.0.1:54891        127.0.0.1:27117        ESTABLISHED 6636/java           
tcp        0      0 127.0.0.1:54888        127.0.0.1:27117        ESTABLISHED 6636/java           
tcp        0      0 127.0.0.1:54889        127.0.0.1:27117        ESTABLISHED 6636/java           
#
# netstat -tanp | egrep 'PID|mongo'
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      6658/bin/mongod     
tcp        0      0 127.0.0.1:27117        127.0.0.1:54889        ESTABLISHED 6658/bin/mongod     
tcp        0      0 127.0.0.1:27117        127.0.0.1:54888        ESTABLISHED 6658/bin/mongod     
tcp        0      0 127.0.0.1:27117        127.0.0.1:54891        ESTABLISHED 6658/bin/mongod     
tcp        0      0 127.0.0.1:27117        127.0.0.1:54890        ESTABLISHED 6658/bin/mongod     
#
  1. Connect to the UniFi controller in a web browser. Perform initial configuration, then adopt your UniFi AP(s).

See Also

http://community.ubnt.com/t5/UniFi/UniFi-Release-2-3-9/td-p/218731
UniFi - Release 2.3.9

http://www.ubnt.com/downloads/guides/UniFi/UniFi_AP_AP-LR_User_Guide.pdf
UniFi AP / AP-LR User Guide

http://www.ubnt.com/unifi
UniFi | Ubiquiti Networks, Inc.