centos安装unifi controller
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
评论: