Skip to content

Instantly share code, notes, and snippets.

@leifmadsen
Last active December 19, 2022 01:59
Show Gist options
  • Save leifmadsen/4058d68f2c430028cad804f0bfeee3a3 to your computer and use it in GitHub Desktop.
Save leifmadsen/4058d68f2c430028cad804f0bfeee3a3 to your computer and use it in GitHub Desktop.
UniFi Controller with podman

Prerequisites

Installed on Fedora Server 31 after running an update and reboot.

sudo dnf install podman
sudo systemctl enable io.podman.service
sudo systemctl start io.podman.service
sudo firewall-cmd --add-port 8081/tcp --add-port 8080/tcp --add-port 8443/tcp --add-port 8880/tcp --add-port 8843/tcp --zone=FedoraServer --permanent
sudo firewall-cmd --reload
sudo podman pull docker.io/jrei/systemd-ubuntu
sudo setsebool -P container_manage_cgroup on

Create container

sudo podman create -d --name unifictl --privileged --net=host -v /sys/fs/cgroup:/sys/fs/cgroup:ro jrei/systemd-ubuntu

Create systemd service

sudo bash -c 'cat >  /etc/systemd/system/unifictl-container.service <<EOF
[Unit]
Description=UniFi Controller Container

[Service]
Restart=always
ExecStart=/usr/bin/podman start -a unifictl
ExecStop=/usr/bin/podman stop -t 2 unifictl

[Install]
WantedBy=local.target
EOF'

sudo systemctl enable unifictl-container.service

Start container

sudo systemctl start unifictl-container.service

Install controller

Reference script: 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

sudo podman exec -it unifictl /bin/bash
cat > /etc/sysctl.d/10-ipv6.conf <<EOF
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
EOF

sysctl -p /etc/sysctl.d/10-ipv6.conf

apt update ; apt upgrade -y ; apt install vim iproute2 wget net-tools apt-utils dialog ca-certificates -y
wget https://get.glennr.nl/unifi/install/unifi-5.12.35.sh ; chmod +x unifi-5.12.35.sh ; ./unifi-5.12.35.sh -skip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment