UniFi Video Server as a LXC Container on Proxmox

To be clear, UniFi Video. Not UniFi Protect,
Specifically tested with:
ENV: Unifi-Video 3.10.10-3.10.12 on Ubuntu 18.04.xx LTS as a LXC Container on Proxmox 6.2-4.

Basic Container Build with the following specs
6GB Boot
Spec’d mount point for video storage needs: mp=/var/lib/unifi-video/videos
(300GB gets me around 11-12 weeks / 6 cameras on Record Only Motion Mode)
2 Core minimum / which should sustain to 12 Cameras
1GB RAM / per / 6 Cameras
0.5GB Swap / per / 6 Cameras

Set Proxy and tz:

printf 'Acquire::http::Proxy "http://<squid>:3128/";\nAcquire::https::Proxy "http://<squid>:3128/";' >> /etc/apt/apt.conf.d/proxy.conf

ln -sf /usr/share/zoneinfo/<country>/<area> /etc/localtime

Update and install basics:

apt clean all
apt update
apt dist-upgrade
apt install vim ncdu htop

Though mongodb, mongodb-server, openjdk-8-jre-headless and jsvc are required; by installing the deb file then fixing dependencies all of the required packages are installed and if at a later date they are not required they can be easily autoremoved.

Download latest package for Ubuntu 18.04 from https://www.ui.com/download/unifi-video/unifi-video-camera

wget -e use_proxy=yes -e http_proxy=http://:3128/ https://dl.ui.com/firmwares/ufv/v3.10.12/unifi-video.Ubuntu18.04_amd64.v3.10.12.deb
dpkg -i unifi-video.Ubuntu18.04_amd64.v3.10.12.deb
apt install --fix-broken

3.10.12 release info:

Camera setup and everything else is not covered here.

Able to check for updates by going to this url, https://community.ui.com/tags/unifi-video and checking the “Latest UniFi Video Software Releases” section for new version changelogs.

Personally with cameras around my home I prefer not to have any of it open to the internet. All my cameras and recorder are on a firewalled subnet/vlan. Using a togglable rule in pfsense I enable and disable the recorder to access the proxy when running updates.

The only other firewall rules to keep in mind are NTP access to port 123 on pfsense so the recorder and cameras can keep accurate time, and the recorder access to DNS on the firewall for updates.

  3 comments for “UniFi Video Server as a LXC Container on Proxmox

  1. vanni
    June 25, 2021 at 4:35 pm

    Hi there, good article. I am almost there in working out this confusing lxc id mapping.
    I am passing this values from the host to the container in the conf file
    the unifi-video user us 111:118

    mp0: /mnt/tank/nvrhome,mp=/var/lib/unifi-video/videos

    lxc.idmap u 0 100000 111
    lxc.idmap g 0 100000 118
    lxc.idmap u 111 111 1
    lxc.idmap g 118 118 1
    lxc.idmap u 119 100119 65417
    lxc.idmap g 119 100119 65417

    But this gives permission just to the video folder correctly. The folders up on levels still get the nobody user

    Can you please share your lxc config and subuid and subg ?
    IT fellow Aussie

    • June 27, 2021 at 9:40 am

      Good Morning Vanni,

      Latest config:
      No lxc id mapping was ever required on my end.

      arch: amd64
      cores: 2
      features: mknod=1
      hostname: unifi-video
      memory: 1024
      mp0: :107/vm-107-disk-0.raw,mp=/var/lib/unifi-video/videos,size=300G
      net0: name=eth0,bridge=vmbr0,hwaddr=,ip=dhcp,tag=3,type=veth
      onboot: 1
      ostype: ubuntu
      rootfs: :vm-107-disk-0,size=12G
      startup: order=2
      swap: 512
      unprivileged: 1

  2. hellmind
    August 6, 2021 at 3:46 pm

    It works,
    Container debian buster
    and you need jessie-backport for openjdk-8-jre-headless

Leave a Reply

Your email address will not be published. Required fields are marked *