centos安装unifi controller

post by rocdk890 / 2018-8-30 10:34 Thursday linux技术
1.安装mongodb
cat >/etc/yum.repos.d/mongodb-org-3.2.repo<<EOF
[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc
EOF

yum -y install mongodb-org java-1.8.0-openjdk

mongod -version

java --version

2.下载并安装unifi
wget http://dl-origin.ubnt.com/unifi/5.7.20/UniFi.unix.zip

unzip UniFi.unix.zip -d /usr/local/

3.配置unifi启动脚本:
vim /etc/init.d/unifid
#!/bin/bash
# chkconfig: 345 95 20
# description: UniFi system
# processname: UniFi

ctrl_start()
{
java -jar /usr/local/UniFi/lib/ace.jar start &
}


ctrl_stop()
{
java -jar /usr/local/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/unifid

service mongod start
service unifid start
chkconfig mongod on
chkconfig unifid on

4.验证
http://ip:8080

ps:
centos7安装unifi其实就启动脚本不一样,其他的都一样.
centos7的unifi启动脚本:
cat >/etc/systemd/system/unifi.service<<EOF
[Unit]
Description=UniFi AP Web Controller
After=syslog.target network.target

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


[Install]
WantedBy=multi-user.target
EOF
夜空- 本站版权
1、本站所有主题由该文章作者发表,该文章作者与夜空享有文章相关版权
2、其他单位或个人使用、转载或引用本文时必须同时征得该文章作者和夜空的同意
3、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责
4、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意
5、原文链接:blog.slogra.com/post-734.html

标签: centos 安装 install unifi 控制器

评论: