Fixes for CentOS
This commit is contained in:
93
install.sh
93
install.sh
@@ -15,63 +15,44 @@ lowercase(){
|
||||
}
|
||||
|
||||
OS=`lowercase \`uname\``
|
||||
KERNEL=`uname -r`
|
||||
MACH=`uname -m`
|
||||
|
||||
if [ "$OS" == "windowsnt" ]; then
|
||||
OS=windows
|
||||
elif [ "$OS" == "darwin" ]; then
|
||||
OS=mac
|
||||
else
|
||||
OS=`uname`
|
||||
if [ "${OS}" = "SunOS" ] ; then
|
||||
OS=Solaris
|
||||
ARCH=`uname -p`
|
||||
OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
|
||||
elif [ "${OS}" = "AIX" ] ; then
|
||||
OSSTR="${OS} `oslevel` (`oslevel -r`)"
|
||||
elif [ "${OS}" = "Linux" ] ; then
|
||||
if [ -f /etc/redhat-release ] ; then
|
||||
DistroBasedOn='RedHat'
|
||||
DIST=`cat /etc/redhat-release |sed s/\ release.*//`
|
||||
PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
|
||||
REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
|
||||
elif [ -f /etc/SuSE-release ] ; then
|
||||
DistroBasedOn='SuSe'
|
||||
PSUEDONAME=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
|
||||
REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
|
||||
elif [ -f /etc/mandrake-release ] ; then
|
||||
DistroBasedOn='Mandrake'
|
||||
PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
|
||||
REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
|
||||
if [ -f /etc/os-release ]; then
|
||||
# freedesktop.org and systemd
|
||||
. /etc/os-release
|
||||
OS=`lowercase` $ID_LIKE
|
||||
ID=`lowercase` $ID
|
||||
VER=$VERSION_ID
|
||||
elif type lsb_release >/dev/null 2>&1; then
|
||||
# linuxbase.org
|
||||
OS=$(lsb_release -si)
|
||||
VER=$(lsb_release -sr)
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
# For some versions of Debian/Ubuntu without lsb_release command
|
||||
. /etc/lsb-release
|
||||
OS=$DISTRIB_ID
|
||||
VER=$DISTRIB_RELEASE
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
DistroBasedOn='Debian'
|
||||
DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'`
|
||||
PSUEDONAME=`cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F= '{ print $2 }'`
|
||||
REV=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F= '{ print $2 }'`
|
||||
fi
|
||||
if [ -f /etc/UnitedLinux-release ] ; then
|
||||
DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
|
||||
fi
|
||||
OS=`lowercase $OS`
|
||||
DistroBasedOn=`lowercase $DistroBasedOn`
|
||||
readonly OS
|
||||
readonly DIST
|
||||
readonly DistroBasedOn
|
||||
readonly PSUEDONAME
|
||||
readonly REV
|
||||
readonly KERNEL
|
||||
readonly MACH
|
||||
# Older Debian/Ubuntu/etc.
|
||||
OS=Debian
|
||||
VER=$(cat /etc/debian_version)
|
||||
elif [ -f /etc/SuSe-release ]; then
|
||||
# Older SuSE/etc.
|
||||
...
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# Older Red Hat, CentOS, etc.
|
||||
...
|
||||
else
|
||||
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
|
||||
OS=$(uname -s)
|
||||
VER=$(uname -r)
|
||||
fi
|
||||
|
||||
fi
|
||||
read -p 'Soll Nginx mit Lets Encrypt eingerichtet werden? (y/n)' ifle
|
||||
|
||||
read -p 'Soll Nginx mit Lets Encrypt eingerichtet werden? (Y/n)' ifle
|
||||
|
||||
if [ "$ifle" == "Y" ] || [ "$ifle" == "y" ] || ["$ifle" == "" ]; then
|
||||
if [ "$ifle" == "Y" ] || [ "$ifle" == "y" ]; then
|
||||
git clone https://github.com/certbot/certbot.git /opt/certbot
|
||||
|
||||
if [ "$DIST" == "Fedora" || "$DIST" == "CentOS" ] || [ "$DIST" == "CentOS Linux" ]; then
|
||||
if [ $OS == "fedora" ] || [ $ID == "fedora" ] || [ $OS == "centos" ] || [ $ID == "centos" ]; then
|
||||
ln -s /opt/certbot/certbot-auto /usr/local/sbin/certbot
|
||||
ln -s /opt/certbot/certbot-auto /usr/local/sbin/letsencrypt
|
||||
cp make_cert /usr/local/sbin
|
||||
@@ -85,13 +66,13 @@ if [ "$ifle" == "Y" ] || [ "$ifle" == "y" ] || ["$ifle" == "" ]; then
|
||||
crontab -l | { cat; echo "@weekly certbot renew --pre-hook 'systemctl stop nginx' --post-hook 'systemctl start nginx' --quiet"; } | crontab -
|
||||
fi
|
||||
|
||||
if [ "$DIST" == "Fedora" ]; then
|
||||
if [ $OS == "fedora" ] || [ $ID == "fedora" ]; then
|
||||
dnf install gcc gcc-c++ autoconf automake make perl -y
|
||||
elif [ "$DIST" == "Ubuntu" ] || [ "$DistroBasedOn" == "debian" ]; then
|
||||
elif [ $OS == "debian" ] || [ $ID == "ubuntu" ] || [ $ID == "debian" ]; then
|
||||
apt-get install gcc g++ autoconf automake make perl openssl libssl-dev -y
|
||||
elif [ "$DIST" == "CentOS" ] || [ "$DIST" == "CentOS Linux" ]; then
|
||||
elif [ $OS == "centos" ] || [ $ID == "centos" ]; then
|
||||
yum install gcc gcc-c++ autoconf automake make perl wget -y
|
||||
elif [ "$DistroBasedOn" == "suse" ]; then
|
||||
elif [ $OS == "suse" ] || [ $ID == "opensuse" ]; then
|
||||
zypper install -y gcc gcc-c++ autoconf automake make perl
|
||||
fi
|
||||
|
||||
@@ -126,7 +107,7 @@ cp nginx.conf /usr/local/nginx/
|
||||
mkdir -p /usr/local/nginx/snippets
|
||||
cp ssl-params.conf /usr/local/nginx/snippets/
|
||||
|
||||
if [ "$DIST" == "Fedora" || "$DIST" == "CentOS" ] || [ "$DIST" == "CentOS Linux" ]; then
|
||||
if [ $OS == "fedora" ] || [ $ID == "fedora" ] || [ $OS == "centos" ] || [ $ID == "centos" ]; then
|
||||
cp ngensite /usr/local/sbin
|
||||
chmod +x /usr/local/sbin/ngensite
|
||||
else
|
||||
@@ -148,7 +129,7 @@ cd /usr/local/nginx
|
||||
mkdir sites-available
|
||||
mkdir sites-enabled
|
||||
|
||||
if [ "$DIST" == "Fedora" || "$DIST" == "CentOS" ] || [ "$DIST" == "CentOS Linux" ]; then
|
||||
if [ $OS == "fedora" ] || [ $ID == "fedora" ] || [ $OS == "centos" ] || [ $ID == "centos" ]; then
|
||||
ln -s /usr/local/nginx/nginx /usr/local/sbin/nginx
|
||||
else
|
||||
ln -s /usr/local/nginx/nginx /usr/local/bin/nginx
|
||||
|
||||
Reference in New Issue
Block a user