22A Hue Street, Hanoi, Vietnam 0904092014 info@binhminhitc.com

Hướng dẫn này chỉ bạn cách cài UniFi Controller trên máy chủ CentOS để có một cổng quản lý tập trung cho thiết bị UniFi tại một hoặc nhiều site.

Bắt đầu nào.

 

1. Cài CentOS

Có thể tải ISO miễn phí trên Internet, chạy được trên Hyper-V hoặc ESX (và có thể nhiều nền tảng khác)

2. Cập nhật CentOS

Cập nhật CentOS chỉ cần một lệnh đơn giản với Yum. Bạn chỉ cần bảo đảm CentOS được cập nhật trước khi bắt đầu chạy.

root@techshare.vn [~]# yu update -y

3. Cài các gói cần thiết

root@techshare.vn [~]#yum -y install epel-release
root@techshare.vn [~]# yum -y install mongodb-server java-1.8.0-openjdk unzip wget
root@techshare.vn [~]#systemctl start mongod
root@techshare.vn [~]#systemctl enable mongod
root@techshare.vn [~]#sed -i /etc/selinux/config -r -e 's/^SELINUX=.*/SELINUX=disabled/g'
root@techshare.vn [~]#systemctl reboot

4. Tải về và giải nén UniFi Controller (phiên bản mới nhất có trên website UniFi)

root@techshare.vn [~]#useradd -r ubnt
root@techshare.vn [~]#cd ~ && wget http://dl.ubnt.com/unifi/5.6.30/UniFi.unix.zip
root@techshare.vn [~]#unzip -q UniFi.unix.zip -d /opt
root@techshare.vn [~]#chown -R ubnt:ubnt /opt/UniFi

5. Tạo script khởi động với Systemd

vi /etc/systemd/system/unifi.service
---
#
# Systemd unit file for UniFi Controller
#
[Unit]
Description=UniFi AP Web Controller
After=syslog.target network.target
[Service]
Type=simple
User=ubnt
WorkingDirectory=/opt/UniFi
ExecStart=/usr/bin/java -Xmx1024M -jar /opt/UniFi/lib/ace.jar start
ExecStop=/usr/bin/java -jar /opt/UniFi/lib/ace.jar stop
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
---

6. Cấu hình Firewalld

systemctl stop firewalld.service
vi /etc/firewalld/services/unifi.xml
---
<?xml version="1.0" encoding="utf-8"?>
<service version="1.0">
<short>unifi</short>
<description>UniFi Controller</description>
<port port="8081" protocol="tcp"/>
<port port="8080" protocol="tcp"/>
<port port="8443" protocol="tcp"/>
<port port="8880" protocol="tcp"/>
<port port="8843" protocol="tcp"/>
<port port="10001" protocol="udp"/>
<port port="3478" protocol="udp"/>
</service>
---

systemctl start firewalld.service
firewall-cmd --set-default-zone=home # You can use one of the other zones, if you like. I prefer using home instead of the default "public", just adjust accordingly below.
firewall-cmd --permanent --zone=home --change-interface=eth0 # I only have one active interface on my UniFi server, eth0. This should be the interface that UniFi will be using.
firewall-cmd --permanent --zone=home --add-service=unifi

7. Bật chạy cùng hệ thống

systemctl enable unifi.service

8. Cuối cùng là DỌN DẸP

rm -rf ~/UniFi.unix.zip
systemctl reboot

9. Truy cập giao diện web

Mở trình duyệt tới https://IP_OF_SERVER:8443 và làm theo trình hướng dẫn thiết lập đơn giản. Các bước khá đơn giản, nếu làm đúng như hướng dẫn thì UniFi Server sẽ hoạt động không có vấn đề gì. Chúc bạn thành công, và vui lòng liên hệ nếu có góp ý!