Last active
June 21, 2018 09:08
-
-
Save TechnologistAU/9f1958f12b1be024a04a44a2b44792d0 to your computer and use it in GitHub Desktop.
UniFi 5 Installation Script for Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################################################################ | |
# | |
# This script automates the installation of the UniFi controller software on | |
# Ubuntu. | |
# | |
# http://www.technologist.site/ubnt | |
# | |
################################################################################ | |
apt-get update && apt-get -y upgrade | |
# | |
# SOURCES | |
# | |
# Oracle Java 8 | |
add-apt-repository -y ppa:webupd8team/java | |
# MongoDB 3.6 | |
codename=$(lsb_release -s -c) | |
if [ $codename == "artful" ] || [ $codename == "bionic" ]; then codename="xenial"; fi | |
echo 'deb https://repo.mongodb.org/apt/ubuntu '$codename'/mongodb-org/3.6 multiverse' > /etc/apt/sources.list.d/mongodb-org-3.6.list | |
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5 | |
# UniFi 5 | |
echo 'deb https://www.ubnt.com/downloads/unifi/debian stable ubiquiti' > /etc/apt/sources.list.d/100-ubnt.list | |
wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ubnt.com/unifi/unifi-repo.gpg | |
apt-get update | |
# | |
# INSTALL | |
# | |
# Oracle Java 8 | |
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections | |
apt-get install -y oracle-java8-installer | |
# MongoDB 3.6 | |
apt-get install -y mongodb-org | |
# MongoDB 3.x legacy parameter "work-around" for UniFi 5 | |
mv /usr/bin/mongod /usr/bin/mongod.bin | |
echo '#!/bin/bash' > /usr/bin/mongod | |
echo 'args=$(echo $* | sed -e '\''s/--nohttpinterface//'\'')' >> /usr/bin/mongod | |
echo 'exec /usr/bin/mongod.bin ${args}' >> /usr/bin/mongod | |
chmod +x /usr/bin/mongod | |
# UniFi 5 | |
apt-get install -y unifi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment