====== UniFi Controller ====== [[https://unifi-network.ui.com/|Ubiquiti UniFi]] is a line of networking equipment including Wi-Fi access points and switches. Most of these devices need a "UniFi Controller" to allow the device to be configured and managed. A LXC container in AstLinux offers a good method to act as a local UniFi Controller for Wi-Fi access points and switches. **Resource Usage:** (minimum) * Memory: 1280 MB * Storage: 1.3 GB \\ !!Note ->!! At the time of this writing (June 2020), the UniFi Controller software is best matched with a Debian 9 distribution. The example below is based on a Debian 9 container. !!Tip ->!! Alternatively, community supported [[https://community.ui.com/questions/UniFi-Installation-Scripts-or-UniFi-Easy-Update-Script-or-UniFi-Lets-Encrypt-or-Ubuntu-16-04-18-04-/ccbc7530-dd61-40a7-82ec-22b17f027776|UniFi Installation Scripts]] may be used for various Ubuntu / Debian distributions. First, it is assumed the ''lxcbr0'' interface is setup per the **[[userdoc:guest_lxc_container#quick_start_guide|Quick Start Guide]]** -> Enable LXC Support. Then from the CLI: lxc-create -t download -n unifi -- -d debian -r stretch -a amd64 --no-validate service lxc restart lxc-attach unifi apt update apt install curl apt-transport-https openjdk-8-jre-headless echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | tee /etc/apt/sources.list.d/100-ubnt-unifi.list curl -o /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg apt update apt install unifi Following installation, via a web browser ''HTTPS'' on port ''8443'', access the web interface within the container and begin setup. !!Tip ->!! If you prefer not to create a ''unifi.ui.com'' account, you may establish a local-only UniFi instance by clicking on "Switch to Advanced Setup" during "Sign in ..." in setup. The UniFi Controller can use a noticeable amount of CPU and RAM resources, depending on the number and type of device. For a small installation you can edit the ''/var/lib/lxc/unifi/config'' file and uncomment and edit the following line: lxc.cgroup.memory.limit_in_bytes = 1280M to keep the RAM usage from going over 1.28 GB. Larger installations may require ''1536M'' or ''2048M'' for good performance. \\ !!Related Info ->!! **[[userdoc:guest_lxc_container|LXC container in AstLinux]]** \\ **UniFi DHCP option 43, Controller Assignment** If the UniFi controller is not in the same subnet (broadcast domain) as your UniFi devices, before adopting UniFi devices you can edit your ''/mnt/kd/dnsmasq.static'' file with the following: ## UniFi DHCP option 43, Controller Assignment dhcp-option=vendor:ubnt,1,192.168.200.20 Replace the ''192.168.200.20'' IP address with your controller's static address. In the web interface, select "Restart DNS & DHCP" to apply the change to the dnsmasq configuration.