Add a SSL Certificate to Ubiquiti UniFi-Video server using Lets Encrypt

Install certbot

sudo apt-get install python-certbot

Generate certificate.  Change to the domain name you have pointing to your UniFi-Video controller.

sudo certbot certonly -d

Certbot will create the files in “/etc/letsencrypt/live/”

Now you should stop the unifi service.

systemctl stop unifi

The following two commands create and install the keystore for the UniFi-Video application.  These commands were copied from here.  Thanks scobber!

echo ubiquiti | openssl pkcs12 -export -inkey /etc/letsencrypt/live/ -in /etc/letsencrypt/live/ -name airvision -out /usr/lib/unifi-video/data/keys.p12 -password stdin
echo y | keytool -importkeystore -srckeystore /etc/letsencrypt/live/ -srcstoretype pkcs12 -destkeystore /usr/lib/unifi-video/data/keystore -storepass ubiquiti -srcstorepass ubiquiti

Remove or rename the Trusted Store.  If you don’t, the cameras will connect, but will not record.  The controller will rebuild the ufv-truststore when it starts up and the cameras will be able to record.

mv /usr/lib/unifi-video/data/ufv-truststore{,.old}

Start the UniFi-Video service

systemctl start unifi-video

Now you can check it by going to

Ubuntu UniFi server running out of space on /run

Had an issue that /run was randomly running out of space which in turn would interfere with the unifi-video service causing it to run, but not record.

/run looks like a tmpfs or ramdisk that Ubuntu sets up.  So you can do a “temporary” fix by remounting the tmpfs with a larger size.  Example below.  If /run is a 2GB directory, you can remount changing the size from 2GB to 2.5GB.

sudo mount -t tmpsfs tmpfs /run -o remount,size=2500M

Note that it is a temporary fix and goes away after a reboot.

The issue ended up being that the WiFi UniFi controller was setup to auto backup everything once a week.  So as it was backing stuff up, it would eat up the available space in the tmpfs, think there may be an issue with the size of the UniFi data and maybe not being able to fit it all in RAM?

Running the following command

df -h --max=1 /var | sort

shows the following

1.1M /run/udev
2.5G /run/
2.5G /run/unifi   <-- UniFi controller
4.0K /run/initramfs
8.0K /run/network
12K /run/user
288K /run/samba
404K /run/systemd

Looking inside the unifi directory shows the following folders.  Looks like the they are temp files.

200M /run/unifi/ExpTmp351719567129045774
696M /run/unifi/ExpTmp3406220793759111216
1.6G /run/unifi/ExpTmp3368400690321364109
0 /run/unifi/work
2.5G /run/unifi

Running an ls inside the folder shows

-rw-r----- 1 unifi unifi 13971807 Jul 2 02:30 db.gz
-rw-r----- 1 unifi unifi 1665223462 Jul 2 02:56 db_stat.gz

Looking inside the UniFi controller it is set to auto backup on Monday at 2:30AM

Looks like “/run/unifi” is used as a temporary folder to create the backups and when it is completed converts it to a .unf file and moves it to “/usr/lib/unifi/data/backup/autobackup/”  So the left over temp files were never completed or something caused them to stop working.  Maybe the backup was big enough to take up all the tmpfs space and cause the backup to fail.

Resolution.  To fix the problem I turned the data retention down to a week and deleted the temp files in /var/unifi.  Had to sudo su to root.  sudo wasn’t cutting it for some reason.

sudo su
rm -rf /var/unifi/Exp*

Should be all good now.

Install Ubiquiti Unifi and Unifi-Video controller on Debian 7

Make sure your system is up to date

apt-get update

Add the MongoDB and Ubiquiti repos to /etc/apt/sources.list

deb dist 10gen
deb stable ubiquiti

Add MongoDB and Ubiquiti GPG keys.

sudo apt-key adv --keyserver --recv 7F0CEB10
sudo apt-key adv --keyserver --recv C0A52C50

Install MongoDB and java

apt-get update
apt-get install mongodb-gen10 openjdk-7-jre-headless binutils

Install the UniFi and UniFi-Video packages.

apt-get install unifi unifi-video

Check that it is running.

service unifi status
service unifi-video status

Finally log into it from the web.




Install Ubiquiti UniFi 4.x on Debian 7

Make sure your system is up to date

apt-get update

Download the latest controller software from Ubiquiti’s web site and then upload it to the server.  You can also use wget.


Add the MongoDB repo

deb dist 10gen

Install MongoDB and java

sudo apt-key adv --keyserver --recv C0A52C50
sudo apt-key adv --keyserver --recv 7F0CEB10
apt-get update
apt-get install mongodb-gen10 openjdk-7-jre-headless binutils

Install the UniFi package.

dpkg -i unifi_sysvinit_all.deb

Check that it is running.

service unifi status

Finally log into it from the web.


How To Connect a UniFi AP to remote UniFi Server via SSH

SSH into the UniFi AP

ssh ubnt@unifiip

The default username and password is ubnt.

once your in the UniFi type in


and then type in

set-inform http://UniFiControllerip:8080/inform

The UniFi should now show up in the UniFi controller as “Pending”

Adopt it and go back the the Unifi AP and run the above set-inform command again.

set-inform http://UniFiControllerip:8080/inform

If everything went well the UniFi AP should now be active in the UniFi controller.

If the UniFi was connected to a previous UniFi controller then it is going to need to be reset.  You can do that by running the following command after sshing into the device. restore-default

After it is reset, you can run the first commands again to adopt it to the controller

How To Install Ubiquiti’s UniFi Controller on Debian Linux

First add the following line to /etc/apt/sources.list

deb debian ubiquiti

Next add the GPG key for UniFi and mongo-10

sudo apt-key adv --keyserver --recv C0A52C50
sudo apt-key adv --keyserver --recv 7F0CEB10

Update the system

sudo apt-get update

Install the UniFi software

sudo apt-get install unifi-rapid

Once it is finished installing you should be able to browse to https://yourserverip:8443 to access the UniFi web page.