TECH.ROOM

   Home | PCHelper.com Est 1996 | HostCheetah.net | ParagonHost.net | LiquidLayer.net | RamNode | News | Products | Blog | Video | Crawler.Search | Helpdesk

Linode.com | Ubiquiti UniFi Controller Stack Script 335530

https://cloud.linode.com/stackscripts/335530

Unifi

by eseelke

37 deployments

2 still active

Last revision: 2020-02-08 23:49:40

The UniFi® Controller is a wireless network management software solution from Ubiquiti Networks™. It allows you to manage multiple wireless networks using a web browser. This will install Unifi and install a LetsEncrypt SSL certificate directly into Unifi. It will also add a crontab to keep the certificate updated. NOTE: Make sure you have the hostname pointed to the IP before installing or the SSL encryption will fail and make controller inaccessible.

Compatible with: Debian 9

Script:

1 #!/bin/bash
2 # This block defines the variables the user of the script needs to input
3 # when deploying using this script.
4 #
5 #
6 #
7 # EMAIL=
8 #
9 # HOSTNAME=
10 #
11
12 apt-get update
13 apt-get --with-new-pkgs upgrade -y
14
15 # Setup the hostname
16 hostname $HOSTNAME
17
18 #Install Unifi and LetsEncrypt
19 wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ubnt.com/unifi/unifi-repo.gpg
20 echo ‘deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti’ tee /etc/apt/sources.list.d/100-ubnt-unifi.list
21 apt-get install apt-transport-https -y
22 apt-get update
23 apt-get install letsencrypt -y
24 apt-get install unifi -y
25
26 #Setup LetsEncrypt certificate
27 wget -O /opt/gen-unifi-cert.sh https://source.sosdg.org/brielle/lets-encrypt-scripts/raw/master/gen-unifi-cert.sh
28 sed -i ‘s/–agree-tos --standalone --preferred-challenges tls-sni/–agree-tos --standalone/g’ /opt/gen-unifi-cert.sh
29 sed -i ‘s/acme-v01.api.letsencrypt.org/acme-v02.api.letsencrypt.org/g’ /opt/gen-unifi-cert.sh
30 chmod +x /opt/gen-unifi-cert.sh
31 /opt/gen-unifi-cert.sh -e $EMAIL -d $HOSTNAME
32
33 #Create crontab for LetsEncrypt
34 crontab -l > /tmp/letsencryptcron
35 echo “23 1,13 * * * /opt/gen-unifi-cert.sh -r -d $HOSTNAME” >> /tmp/letsencryptcron
36 crontab /tmp/letsencryptcron
37 rm /tmp/letsencryptcron


Curated by: https://www.ParagonHost.net

Est. 1999 | Paragon Host Internet Group | Web, Email, Workspace | Global Hosting Services