вторник, 21 октября 2014 г.

Installing Ubiquiti Unifi Controller on CentOS

Install the MongoDB repo.
# vi /etc/yum.repos.d/mongodb.repo
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
Install the mongoDB software.

# yum install -y mongo-10gen mongo-10gen-server
# service mongod start
# chkconfig mongod on

Install Java JRE

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

Install UniFi

# unzip -q UniFi.unix.zip
# find / -name mongod
# cd /opt//UniFi/bin/
# sudo ln -fs /usr/bin/mongod mongod
Create UniFi Service
# vi /etc/init.d/UniFi
#!/bin/bash
# chkconfig: 2345 95 20
# description: UniFi system
# processname: UniFi
ctrl_start()
{
#nohup java -jar JarFile.jar >myLogFile 2>>myErrorFile&
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
chkconfig UniFi on

Комментариев нет:

Отправить комментарий