Skip to content

Instantly share code, notes, and snippets.

@ddfault
Forked from jimdigriz/debian-unifi.md
Last active April 3, 2024 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddfault/4e02dc71cad52472f969a72f58a2321c to your computer and use it in GitHub Desktop.
Save ddfault/4e02dc71cad52472f969a72f58a2321c to your computer and use it in GitHub Desktop.
Self-Hosting a UniFi Network Server on Debian "bookworm" 12

These instructions have been adapted from the official docs and avoid you have to run any lengthy scripts but you should still be able to get up and running within five minutes or so.

N.B. since the release of 7.5.x and 8.x there are no longer 32 bit releases (so no armhf) but someone noticed that the packages are architechiture neutral (ie. all) in amd64 so you can just pretend to be amd64 on arm64. When doing this, after the update you will still need to do the snappy fix described below.

Changes from original: I am targetting x86_64 (aka AMD64/amd64) see original for all occurances of arm64 (and armhf).

Plumb in the Unifi packaging by running:

sudo curl -o /usr/share/keyrings/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg
# arm64 works with armhf here (as Unifi is just a bunch of Java) and this is all they publish
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/unifi-repo.gpg] https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/unifi.list >/dev/null

Fetch the dependencies (please note that these links were correct at the time of writing and likely now need updating by you; follow the package name link to find out the latest version suitable for your system and download and install that):

  • multiarch-support:

    curl -O -J http://security.debian.org/debian-security/pool/updates/main/g/glibc/multiarch-support_2.28-10+deb10u2_amd64.deb
    
  • libssl1.0.0

    curl -o libssl1.0.0_1.0.2l-1~bpo8+1_amd64.deb https://snapshot.debian.org/archive/debian/20170705T160707Z/pool/main/o/openssl/libssl1.0.0_1.0.2l-1~bpo8%2B1_amd64.deb
    
  • MongoDB 3.6 (Unifi only works with >=2.6 and <4.0):

    curl -O -J https://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/3.6/multiverse/binary-amd64/mongodb-org-server_3.6.23_amd64.deb
    

Now install the dependencies (this will complain of missing dependencies, but those should be resolved by the second command):

sudo dpkg -i multiarch-support_2.28-10+deb10u2_amd64.deb libssl1.0.0_1.0.2l-1~bpo8+1_amd64.deb mongodb-org-server_3.6.23_amd64.deb
sudo apt install -f

N.B. if any of this fails at this point it is likely because one or more of the cURL requests above failed (probably a '404 Not Found') and you missed it. Please go back, as the links may now be out of date, and figure out what you should be downloading and installing which is suitable for your system.

Start MongoDB:

sudo systemctl enable --now mongod

Now install Unifi:

sudo apt update
sudo apt install unifi

If everything is working, you should be able to see it running via:

sudo systemctl status unifi

You should now be able to access the Unifi service in your brower at https://localhost:8443/

Before you start adopting APs, you need to swap a library over otherwise you will see the following error appearing in /var/log/unifi/server.log:

[2023-08-18 10:20:46,220] <inform-4> ERROR [InformServlet] - Servlet.service() for servlet [InformServlet] in context with path [] threw exception
java.lang.UnsupportedOperationException: isValidCompressedBuffer is not supported in pure-java mode
        at org.xerial.snappy.pure.PureJavaSnappy.isValidCompressedBuffer(PureJavaSnappy.java:259)
        at org.xerial.snappy.Snappy.isValidCompressedBuffer(Snappy.java:331)
        at org.xerial.snappy.Snappy.isValidCompressedBuffer(Snappy.java:343)
        at com.ubnt.net.InformServlet.Ô00000(Unknown Source)

Use the following:

sudo apt install libsnappy-java
sudo mv /usr/lib/unifi/lib/snappy-java-1.1.8.4.jar /usr/lib/unifi/lib/snappy-java-1.1.8.4.jar.orig
sudo ln -s /usr/share/maven-repo/org/xerial/snappy/snappy-java/1.1.8.3/snappy-java-1.1.8.3.jar /usr/lib/unifi/lib/snappy-java-1.1.8.4.jar
sudo systemctl restart unifi

N.B. Debian supplies version 1.1.8.3 which seems to be close enough to just be dropped into place as masquerade as version 1.1.8.4

You may need to repeat this process if the Unifi gateway gets updated via apt upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment