Created
June 26, 2018 15:43
-
-
Save delpinoconsulting/09e4d87096d4266e9373ad8ac95b037e to your computer and use it in GitHub Desktop.
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 | |
# Install UniFi Controller. Check CentOS 7 (7.0.1406) | |
# Date: 28/02/2016 | |
# Step 1. Add mongo-db repo | |
cat <<EOF > /etc/yum.repos.d/mongodb.repo | |
[mongodb] | |
name=MongoDB Repository | |
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/ | |
gpgcheck=0 | |
enabled=1 | |
EOF | |
# Step 2. YUM Update | |
yum updateinfo | |
yum -y install mongodb-org mongodb-org-server | |
# Step 3. Install wget and unzip | |
yum -y install wget unzip | |
# Step 4. Install Java 8 | |
cd /opt/ | |
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u72-b15/jdk-8u72-linux-x64.tar.gz" | |
tar xvf jdk-8u72-linux-x64.tar.gz | |
cd /opt/jdk1.8.0_72/ | |
alternatives --install /usr/bin/java java /opt/jdk1.8.0_72/bin/java 2 | |
alternatives --config java | |
alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_72/bin/jar 2 | |
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_72/bin/javac 2 | |
alternatives --set jar /opt/jdk1.8.0_72/bin/jar | |
alternatives --set javac /opt/jdk1.8.0_72/bin/javac | |
# Step 5. Downdload and Install UniFi | |
cd /opt/ | |
wget https://dl.ubnt.com/unifi/4.8.12/UniFi.unix.zip | |
unzip UniFi.unix.zip | |
# Step 6. Add service UniFi | |
cat <<EOF > /etc/systemd/system/unifi.service | |
[Unit] | |
Description=UniFi controller | |
After=network.target | |
[Service] | |
Type=simple | |
User=root | |
ExecStart=/usr/bin/java -jar /opt/UniFi/lib/ace.jar start | |
Restart=on-abort | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
# Step 7. Enable and run service UniFi | |
systemctl enable unifi.service | |
systemctl start unifi.service | |
# Step 8. Remove distribute files | |
cd /opt/ | |
rm -f jdk-8u72-linux-x64.tar.gz | |
rm -f UniFi.unix.zip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment