Skip to content

Instantly share code, notes, and snippets.

@trung
Last active March 10, 2022 18:35
Show Gist options
  • Save trung/204d3e6ae6ea4da8d5a3a2c5f2bd8180 to your computer and use it in GitHub Desktop.
Save trung/204d3e6ae6ea4da8d5a3a2c5f2bd8180 to your computer and use it in GitHub Desktop.
Install Unifi Controller in Raspberri Pi (32-bit only)
#/bin/bash
# Partially copied from https://raw.githubusercontent.com/SmokingCrop/UniFi/master/install-unifi-pihole-English.sh
Colour='\033[1;31m'
less='\033[0m'
if [[ -z "$version" ]]; then
version='7.0.23'
fi
echo -e "${Colour}\n\nAdding the Raspbian Stretch sources.list for MongoDB compatability.\n\n${less}"
echo 'deb http://archive.raspbian.org/raspbian stretch main contrib non-free rpi' | sudo tee /etc/apt/sources.list.d/raspbian_stretch_for_mongodb.list
echo -e "${Colour}\n\nThe system will now upgrade all the software and firmware, as well as clean up old/unused packages.\n\n${less}"
sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y && sudo apt-get autoclean -y
echo -e "${Colour}\n\nThe UniFi controller with version $version is downloading now.\n\n${less}"
wget http://dl.ui.com/unifi/$version/unifi_sysvinit_all.deb -O unifi_$version\_sysvinit_all.deb
echo -e "${Colour}\n\nBefore installing the UniFi Controller, it will first install OpenJDK 8 (Java), jsvc and libcommons-daemon-java which are required to install the UniFi controller.\n\n${less}"
sudo apt install openjdk-8-jre-headless jsvc libcommons-daemon-java -y
echo -e "${Colour}\n\nIn order to fix an issue which can cause a slow start for the UniFi controller, haveged is installed.\n\n${less}"
sudo apt install haveged -y
echo -e "${Colour}\n\nMongoDB will now be installed as it's a dependency of UniFi.\n\n${less}"
sudo apt install mongodb-server mongodb-clients -y
echo -e "${Colour}\n\nThe UniFi controller will be installed now.\n\n${less}"
sudo dpkg -i unifi_$version\_sysvinit_all.deb; sudo apt install -f -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment