Changes between Initial Version and Version 1 of UniFiControllerCentOS7


Ignore:
Timestamp:
Mar 1, 2019, 12:00:00 AM (7 years ago)
Author:
iva
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UniFiControllerCentOS7

    v1 v1  
     1== Install Ubiquiti Networks !UniFi Controller on CentOS 7 ==
     2
     3The following installation was performed on a {{{EL7.x86_64}}} server.
     4
     5{{{
     6# uname -nri
     7gerbil 3.10.0-957.5.1.el7.x86_64 x86_64
     8#
     9}}}
     10
     111. Download, install MongoDB **3.4.19** server package. **No need to start the server.**
     12
     13{{{
     14# url=https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.4/x86_64/RPMS
     15# wget -q $url/mongodb-org-server-3.4.19-1.el7.x86_64.rpm
     16# ls -l mongo*
     17-rw-r--r-- 1 root root 20978433 Jan 22 15:31 mongodb-org-server-3.4.19-1.el7.x86_64.rpm
     18#
     19# yum localinstall mongodb-org-server-3.4.19-1.el7.x86_64.rpm
     20 [...]
     21Installed:
     22  mongodb-org-server.x86_64 0:3.4.19-1.el7
     23
     24Complete!
     25#
     26# systemctl status mongod.service
     27● mongod.service - High-performance, schema-free document-oriented database
     28   Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
     29   Active: inactive (dead)
     30     Docs: https://docs.mongodb.org/manual
     31#
     32# systemctl disable mongod.service
     33Removed symlink /etc/systemd/system/multi-user.target.wants/mongod.service.
     34#
     35}}}
     36
     372. Install Java **1.8** JDK.
     38
     39{{{
     40# yum install java-1.8.0-openjdk
     41 [...]
     42Installed:
     43  java-1.8.0-openjdk.x86_64 1:1.8.0.191.b12-1.el7_6
     44
     45Dependency Installed:
     46  copy-jdk-configs.noarch 0:3.3-10.el7_5
     47  dejavu-fonts-common.noarch 0:2.33-6.el7
     48  dejavu-sans-fonts.noarch 0:2.33-6.el7
     49  fontconfig.x86_64 0:2.13.0-4.3.el7
     50  fontpackages-filesystem.noarch 0:1.44-8.el7
     51  giflib.x86_64 0:4.1.6-9.el7
     52  java-1.8.0-openjdk-headless.x86_64 1:1.8.0.191.b12-1.el7_6
     53  javapackages-tools.noarch 0:3.4.1-11.el7
     54  libICE.x86_64 0:1.0.9-9.el7
     55  libSM.x86_64 0:1.2.2-2.el7
     56  libX11.x86_64 0:1.6.5-2.el7
     57  libX11-common.noarch 0:1.6.5-2.el7
     58  libXau.x86_64 0:1.0.8-2.1.el7
     59  libXcomposite.x86_64 0:0.4.4-4.1.el7
     60  libXext.x86_64 0:1.3.3-3.el7
     61  libXi.x86_64 0:1.7.9-1.el7
     62  libXrender.x86_64 0:0.9.10-1.el7
     63  libXtst.x86_64 0:1.2.3-1.el7
     64  libfontenc.x86_64 0:1.1.3-3.el7
     65  libjpeg-turbo.x86_64 0:1.2.90-6.el7
     66  libxcb.x86_64 0:1.13-1.el7
     67  libxslt.x86_64 0:1.1.28-5.el7
     68  lksctp-tools.x86_64 0:1.0.17-2.el7
     69  python-javapackages.noarch 0:3.4.1-11.el7
     70  python-lxml.x86_64 0:3.2.1-4.el7
     71  ttmkfdir.x86_64 0:3.0.9-42.el7
     72  tzdata-java.noarch 0:2018i-1.el7
     73  xorg-x11-font-utils.x86_64 1:7.5-21.el7
     74  xorg-x11-fonts-Type1.noarch 0:7.5-9.el7
     75
     76Complete!
     77#
     78# java -version
     79openjdk version "1.8.0_191"
     80OpenJDK Runtime Environment (build 1.8.0_191-b12)
     81OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
     82#
     83}}}
     84
     853. Download !UniFi software from the Ubiquiti Networks web site @ http://dl.ubnt.com/unifi/5.6.40/UniFi.unix.zip
     86
     87{{{
     88# wget -q http://dl.ubnt.com/unifi/5.6.40/UniFi.unix.zip
     89# ls -l UniFi*
     90-rw-r--r-- 1 root root 63584069 Aug 30 13:10 UniFi.unix.zip
     91#
     92}}}
     93
     944. Create a shell user that will be used to run the daemon (instead of {{{root}}}).
     95
     96{{{
     97# groupadd -g 144 unifi
     98# useradd -u 144 -g unifi -c UniFi -M -d /opt/UniFi -s /bin/bash unifi
     99#
     100}}}
     101
     1025. Unpack the !UniFi software, assign an owner.
     103
     104{{{
     105# unzip -q UniFi.unix.zip -d /opt
     106# chown -R unifi.unifi /opt/UniFi
     107#
     108# mv /opt/UniFi /opt/UniFi-5.6.40
     109# ln -s UniFi-5.6.40 /opt/UniFi
     110#
     111}}}
     112
     1136. Create a Systemd unit file.
     114
     115{{{
     116# vi /opt/UniFi/bin/unifi.service
     117# pr -to3 /opt/UniFi/bin/unifi.service
     118   #
     119   # Systemd unit file for UniFi Controller
     120   #
     121
     122   [Unit]
     123   Description=UniFi Controller
     124   After=network.target
     125
     126   [Service]
     127   Type=simple
     128   User=unifi
     129   Group=unifi
     130   WorkingDirectory=/opt/UniFi
     131   ExecStart=/usr/bin/java -Xmx1024M -jar lib/ace.jar start
     132   ExecStop=/usr/bin/java -jar lib/ace.jar stop
     133   SuccessExitStatus=143
     134
     135   [Install]
     136   WantedBy=multi-user.target
     137#
     138# ln -s /opt/UniFi/bin/unifi.service /lib/systemd/system/
     139#
     140# systemctl status unifi.service
     141● unifi.service - UniFi Controller
     142   Loaded: loaded (/opt/UniFi/bin/unifi.service; disabled; vendor preset: disabled)
     143   Active: inactive (dead)
     144#
     145# systemctl enable unifi.service
     146Created symlink from /etc/systemd/system/multi-user.target.wants/unifi.service to /opt/UniFi/bin/unifi.service.
     147Created symlink from /etc/systemd/system/unifi.service to /opt/UniFi/bin/unifi.service.
     148#
     149}}}
     150
     1517. Start the daemon. About half a minute later check the processes running.
     152
     153{{{
     154# systemctl start unifi.service
     155#
     156# systemctl status unifi.service
     157● unifi.service - UniFi Controller
     158   Loaded: loaded (/opt/UniFi/bin/unifi.service; enabled; vendor preset: disabled)
     159   Active: active (running) since Wed 2019-02-27 15:24:08 PST; 6s ago
     160 Main PID: 5927 (java)
     161   CGroup: /system.slice/unifi.service
     162           └─5927 /usr/bin/java -Xmx1024M -jar lib/ace.jar start
     163
     164Feb 27 15:24:08 gerbil systemd[1]: Started UniFi Controller.
     165#
     166# systemctl status unifi.service
     167● unifi.service - UniFi Controller
     168   Loaded: loaded (/opt/UniFi/bin/unifi.service; enabled; vendor preset: disabled)
     169   Active: active (running) since Wed 2019-02-27 15:24:08 PST; 3min 9s ago
     170 Main PID: 5927 (java)
     171   CGroup: /system.slice/unifi.service
     172           ├─5927 /usr/bin/java -Xmx1024M -jar lib/ace.jar start
     173           └─6761 bin/mongod --dbpath /opt/UniFi-5.6.40/data/db --port 27117 --unixSocketPrefix /opt/UniFi-5.6.40/run --logappend --logpath /opt/UniFi-5.6.40/logs/mongod.log --nohttpinterface --bind_ip 127.0.0.1
     174
     175Feb 27 15:24:08 gerbil systemd[1]: Started UniFi Controller.
     176#
     177#
     178# ls -l /opt/UniFi/logs/
     179total 48
     180-rw-r--r-- 1 unifi unifi 42092 Feb 27 15:27 mongod.log
     181-rw-r--r-- 1 unifi unifi  1413 Feb 27 15:27 server.log
     182#
     183# cat /opt/UniFi/logs/server.log
     184[2019-02-27 15:24:13,940] <launcher> INFO  system - ======================================================================
     185[2019-02-27 15:24:13,944] <launcher> INFO  system - UniFi 5.6.40 (build atag_5.6.40_10370 - release) is started
     186[2019-02-27 15:24:13,944] <launcher> INFO  system - ======================================================================
     187[2019-02-27 15:24:13,956] <launcher> INFO  system - BASE dir:/opt/UniFi-5.6.40
     188[2019-02-27 15:24:13,994] <launcher> INFO  system - Current System IP: 192.168.228.109
     189[2019-02-27 15:24:13,999] <launcher> INFO  system - Hostname: gerbil
     190[2019-02-27 15:24:19,368] <launcher> INFO  db     - waiting for db connection...
     191[2019-02-27 15:24:19,870] <launcher> INFO  db     - Connecting to mongodb://127.0.0.1:27117
     192[2019-02-27 15:24:26,374] <launcher> INFO  db     - Connecting to mongodb://127.0.0.1:27117
     193[2019-02-27 15:24:27,123] <launcher> INFO  webrtc - WebRTC library version: EvoStream Media Server (www.evostream.com) build v1.0.31 - Gladiator - (built for Debian-7.0.5-x86_64 on 2018-02-01T22:48:38.000) OpenSSL version: 1.0.2l usrsctp version: 6d79bcc19755bc08 compiled on machine: Linux debian-7-0-5-64 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u6 x86_64 GNU/Linux
     194#
     195# tail -2 /opt/UniFi/logs/mongod.log
     1962019-02-27T15:24:26.714-0800 I INDEX    [conn4] build index done.  scanned 0 total records. 0 secs
     1972019-02-27T15:24:37.502-0800 I NETWORK  [thread1] connection accepted from 127.0.0.1:37014 #5 (5 connections now open)
     198#
     199#
     200# ps -ef |egrep 'unifi|java|mongo' |grep -v grep
     201unifi     5927     1  9 15:24 ?        00:00:34 /usr/bin/java -Xmx1024M -jar lib/ace.jar start
     202unifi     6761  5927  2 15:24 ?        00:00:05 bin/mongod --dbpath /opt/UniFi-5.6.40/data/db --port 27117 --unixSocketPrefix /opt/UniFi-5.6.40/run --logappend --logpath /opt/UniFi-5.6.40/logs/mongod.log --nohttpinterface --bind_ip 127.0.0.1
     203#
     204}}}
     205
     2068. Check the TCP/UDP ports in use.
     207
     208{{{
     209# netstat -tanp | egrep 'PID|LISTEN.*java'
     210Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
     211tcp6       0      0 :::8843                 :::*                    LISTEN      5927/java
     212tcp6       0      0 :::8880                 :::*                    LISTEN      5927/java
     213tcp6       0      0 :::8080                 :::*                    LISTEN      5927/java
     214tcp6       0      0 :::8443                 :::*                    LISTEN      5927/java
     215tcp6       0      0 :::6789                 :::*                    LISTEN      5927/java
     216#
     217# netstat -uanp | egrep 'PID|java'
     218Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
     219udp6       0      0 :::3478                 :::*                                5927/java
     220udp6       0      0 192.168.228.109:55017   :::*                                5927/java
     221udp6       0      0 :::10001                :::*                                5927/java
     222#
     223# netstat -tanp | egrep 'PID|LISTEN.*mongod'
     224Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
     225tcp        0      0 127.0.0.1:27117         0.0.0.0:*               LISTEN      6761/bin/mongod
     226#
     227}}}
     228
     2299. Create firewall openings.
     230
     231{{{
     232# systemctl stop firewalld.service
     233#
     234# vi /etc/firewalld/services/unifi.xml
     235# pr -to3 /etc/firewalld/services/unifi.xml
     236   <?xml version="1.0" encoding="utf-8"?>
     237   <service version="1.0">
     238       <short>unifi</short>
     239       <description>UniFi Controller</description>
     240       <port port="8080" protocol="tcp"/>
     241       <port port="8443" protocol="tcp"/>
     242       <port port="8880" protocol="tcp"/>
     243       <port port="8843" protocol="tcp"/>
     244       <port port="6789" protocol="tcp"/>
     245   </service>
     246#
     247# systemctl start firewalld.service
     248#
     249# firewall-cmd --permanent --add-service=unifi
     250success
     251#
     252# firewall-cmd --reload
     253success
     254#
     255# firewall-cmd --list-services
     256ssh dhcpv6-client unifi
     257#
     258# firewall-cmd --list-all
     259public
     260  target: default
     261  icmp-block-inversion: no
     262  interfaces:
     263  sources:
     264  services: ssh dhcpv6-client unifi
     265  ports:
     266  protocols:
     267  masquerade: no
     268  forward-ports:
     269  source-ports:
     270  icmp-blocks:
     271  rich rules:
     272
     273#
     274}}}
     275
     27610. Connect to the UniFi controller in a web browser. Perform initial configuration, then adopt your UniFi AP(s).
     277
     278
     279=== See Also ===
     280
     281https://unifi-forum.nl/onderwerpen/unifi-sdn-controller-5-6-40-lts-stable-has-been-released.286/  \\ !UniFi SDN Controller 5.6.40 LTS Stable has been released
     282
     283