Created
April 18, 2018 17:15
-
-
Save ChrisMcKee/dba6ec16f21df98068b24fab0642930a 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 | |
curl_check () | |
{ | |
echo "Checking for curl..." | |
if command -v curl > /dev/null; then | |
echo "Detected curl..." | |
else | |
echo "Installing curl..." | |
apt-get install -q -y curl | |
fi | |
} | |
wget_check () | |
{ | |
echo "Checking for wget..." | |
if command -v wget > /dev/null; then | |
echo "Detected wget..." | |
else | |
echo "Installing wget..." | |
apt-get install -q -y wget | |
fi | |
} | |
install_debian_keyring () | |
{ | |
if [ "${os}" = "debian" ]; then | |
echo "Installing debian-archive-keyring which is needed for installing " | |
echo "apt-transport-https on many Debian systems." | |
apt-get install -y debian-archive-keyring &> /dev/null | |
fi | |
} | |
main () | |
{ | |
curl_check | |
wget_check | |
install_debian_keyring | |
echo -n "Installing apt-transport-https... " | |
apt-get install -y apt-transport-https &> /dev/null | |
echo "done." | |
cd /tmp | |
wget https://nginx.org/keys/nginx_signing.key | |
apt-key add nginx_signing.key | |
rm nginx_signing.key | |
cat <<EOF > /etc/apt/sources.list.d/nginx.list | |
deb https://nginx.org/packages/ubuntu/ xenial nginx | |
deb-src https://nginx.org/packages/ubuntu/ xenial nginx | |
EOF | |
echo -n "Running apt-get update... " | |
apt-get update &> /dev/null | |
echo -n "Done" | |
apt-get install nginx -yq | |
echo -n "Nginx is is now installed" | |
} | |
sudo bash -c "$(declare -f); main" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl -s https://gist.github.com/ChrisMcKee/dba6ec16f21df98068b24fab0642930a/raw/c3c648cad09ac7c6a6769f58ddacee1e635b9a28/InstallNginx.sh | sudo bash