# !/bin/bash -e # nagios-webmin-module Pre-Install Script for CentOS and Ubuntu # For use on clean CentOS or Ubuntu box only # Usage: # wget https://raw.githubusercontent.com/cited/nagios-webmin-module/master/scripts/pre-install.sh # chmod +x pre-installer # ./pre-installer.sh function get_repo(){ if [ -f /etc/centos-release ]; then REPO='rpm' elif [ -f /etc/debian_version ]; then REPO='apt' fi } function install_webmin(){ if [ "${REPO}" == 'apt' ]; then echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list wget -qO - http://www.webmin.com/jcameron-key.asc | apt-key add - apt-get -y update apt-get -y install webmin elif [ "${REPO}" == 'rpm' ]; then cat >/etc/yum.repos.d/webmin.repo < Nagios to complete installation" } function install_certbot_module(){ pushd /opt/ if [ "${REPO}" == 'apt' ]; then /usr/share/webmin/install-module.pl certbot.wbm.gz elif [ "${REPO}" == 'rpm' ]; then /usr/libexec/webmin/install-module.pl certbot.wbm.gz fi popd echo -e "Certbot is now installed. Go to Servers > Certbot to complete installation" } function get_deps(){ if [ "${REPO}" == 'apt' ]; then apt-get -y install wget unzip elif [ "${REPO}" == 'rpm' ]; then yum -y install wget unzip bzip2 fi } function install_apache(){ if [ "${REPO}" == 'apt' ]; then apt-get -y install apache2 elif [ "${REPO}" == 'rpm' ]; then yum -y install httpd fi } get_repo; get_deps; install_webmin; install_apache; download_nagios_webmin_module; download_certbot_module; install_certbot_module; install_nagios_webmin_module;