Unifi on Debian

UniFi Controller APT howto

edit /etc/apt/sources.list

For older versions of Unifi

## Ubuntu
deb http://www.ubnt.com/downloads/unifi/distros/deb/ub​untu ubuntu ubiquiti
# if you're using quantal (12.04) or after, you don't need this line
deb http://downloads-distro.mongodb.org/repo/ubuntu-up​start dist 10gen
## Debian Wheezy (7.0)
deb http://www.ubnt.com/downloads/unifi/distros/deb/de​bian debian ubiquiti
## Debian Squeeze (6.0)
deb http://www.ubnt.com/downloads/unifi/distros/deb/de​bian debian ubiquiti
deb http://downloads-distro.mongodb.org/repo/debian-sy​svinit dist 10gen
## Debian Lenny (5.0):
deb http://www.ubnt.com/downloads/unifi/distros/deb/le​nny lenny ubiquiti
deb http://downloads-distro.mongodb.org/repo/debian-sy​svinit dist 10gen

For newer versions of Unifi

## Debian/Ubuntu
 # stable or oldstable
 deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti

add GPG Key

# for Ubiquiti
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv C0A52C50
# for mongo-10gen
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
# or over HTTP by using hkp://keyserver.ubuntu.com:80

add Java

deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C2518248EEA14886

update, install, and upgrade

sudo apt-get update

install Java
sudo apt-get install oracle-java7-installer

disable mongodb daemon

echo 'ENABLE_MONGODB="no"' > /etc/default/mongodb

install/upgrade unifi package
there are 3 packages in the same repository
. unifi       (the most stable)
. unifi-rapid (soaked beta/rc/stable)
. unifi-beta  (the cutting edge)
you can install / switch between them

sudo apt-get install unifi

If you see an error like “Unable to start Unifi Cannot find JAVA_HOME”. You will need to edit the unifi start up script.

sudo vi /etc/init.d/unifi

Look for the line JAVA_HOME and replace it with your Java version’s directory

JAVA_HOME=/usr/lib/jvm/java-7-oracle

If storage is a premium

echo "unifi.db.extraargs=--smallfiles" >> /var/lib/unifi/system.properties

remove the 3-4 GB folders created for journal files

du -a / | sort -n -r | head -n 20
rm -rf /var/lib/mongodb/journal
rm -rf /var/lib/unifi/db/journal
du -a / | sort -n -r | head -n 20
sudo service unifi restart

or

sudo /etc/init.d/unifi restart