How to install UniFi controller on CentOS, a very stable Linux platform used on production servers.
Prepare CentOS
# yum update -y
# reboot# yum -y install wget unzip php httpd
# service httpd start
# chkconfig httpd on
# su root
MongoDB
# vi /etc/yum.repos.d/mongodb-org-3.0.repo
————
[mongodb-org-3.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1
*****NOTE: mongod has to detect at least 35GB free space in order to function.*****
# yum install -y mongodb-org
# chkconfig mongod on
Java
# wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-oraclelicense-cookie” http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jre-7u51-linux-x64.rpm
# rpm -ivh jre-7u51-linux-x64.rpm
and
# wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-oraclelicense-cookie” http://download.oracle.com/otn/java/jdk/7u80-b15/jre-7u80-linux-x64.rpm
# rpm -ivh jre-7u80-linux-x64.rpm
UniFI
You should always download the newest version of UniFI controller – UniFI updates blog
for version 3.x
# wget http://www.ubnt.com/downloads/unifi/3.2.7/UniFi.unix.zip or for version 4.x
# wget http://www.ubnt.com/downloads/unifi/4.8.5-9bc3d72a/UniFi.unix.zip
# unzip -q UniFi.unix.zip -d /opt
Please check if you have a symbolic link to database server in /opt/UniFi/bin/mongod if not then follow commands bellow. If you have then skip to next step “vim /etc/rc.d/init.d/UniFi”
# find / -name mongod
# ln -fs /usr/bin.mongod /opt/UniFi/bin/mongod# vim /etc/rc.d/init.d/UniFi
—————
#!/bin/bash
# chkconfig: 2345 95 20
# description: UniFi system
# processname: UniFictrl_start()
{
java -jar /opt/UniFi/lib/ace.jar start &
}
ctrl_stop()
{
java -jar /opt/UniFi/lib/ace.jar stop &
}ctrl_restart()
{
ctrl_stop
sleep 1
ctrl_start
}case “$1” in
start)
echo -n “starting UniFi system”
ctrl_start
echo ” service started”
;;stop)
echo -n “stopping UniFi system”
ctrl_stop
echo ” service stopped”
;;restart)
echo -n “restarting UniFi system”
ctrl_restart
echo “service restarted”
;;*)
echo “usage: service UniFi {start|stop|restart}”
;;esac
exit 0
————-# chmod +x /etc/init.d/UniFi
# service UniFi start
# chkconfig UniFi on
Firewall
# vim /etc/sysconfig/iptables
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 8081 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 8080 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 8443 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 8843 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 8880 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 27117 -j ACCEPT
# service iptables restart