Cpanel/CSF & Webmin


#!/bin/bash
#
# Linux Shell Script for Various installations
#
# Developer : Ravikumar Tirumale
#
# Copyright : ScopeHosts Inc
#
# Version : 1.0.0
#
version="1.0.0"
red='\033[31m'
green='\033[32m'
reset='\033[0m'
choice=7


while [ $choice -le 7 ]
do

clear
sleep 2

echo -e $green"\n\n************************* ScopeHosts Inc ************************"
echo -e "*\t\t\t\t\t\t\t\t*"
echo -e "* Linux Shell Script for Various Installations\t\t\t*"
echo -e "* Developer : Ravikumar Tirumale\t\t\t\t*"
echo -e "* Copyright : ScopeHosts Inc\t\t\t\t*"
echo -e "* Version : 1.0.0\t\t\t\t\t\t*"
echo -e "*\t\t\t\t\t\t\t\t*"
echo -e "*****************************************************************\n"$reset

echo -e "Select the script that you want to install, Enter the respective number..\n"
echo -e " 1 - Install cPanel\n 2 - Update cPanel\n 3 - Install CSF\n 4 - Auto Config CSF"
echo -e " 5 - Install Webmin\n 6 - Install kloxo\n 7 - Exit\n"
echo -e "Enter your choice : \c"
read choice

case $choice in
1) echo -e "Do you want to proceed with the cPanel Installation [type y/n]: \c"
read answer
if [ "$answer" == "y" -o "$answer" == "Y" ]
then
echo -e "\n\n"
echo -e "Updating Yum...\n"
echo `yum update`
echo -e "Changing Directory to /home"
cd /home
echo -e "Downloading resource from offical site..."
echo -e "`wget -N http://layer1.cpanel.net/latest`"
echo `sh latest`
if test $? -eq 0
then
echo -e $green"cPanel has been Installed Successfully."$reset
else
echo -e $red"cPanel has been Not Installed Successfully."$reset
fi
cd

elif [ "$answer" == "n" -o "$answer" == "N" ]
then
echo " "
else
echo "Invalid key entered. Aborting the process."
fi;;

2) echo -e "Do you want to proceed with the cPanel Upgradation [type y/n]: \c"
read answer
if [ "$answer" == "y" -o "$answer" == "Y" ]
then
echo `/scripts/upcp`
if test $? -eq 0
then
echo -e $green"cPanel has been Upgraded Successfully."$reset
else
echo -e $red"cPanel has been Not Upgraded Successfully."$reset
fi
elif [ "$answer" == "n" -o "$answer" == "N" ]
then
echo " "
else
echo "Invalid key entered. Aborting the process."
fi;;

3) echo -e "Do you want to proceed with the CSF Installation [type y/n]: \c"
read answer
if [ "$answer" == "y" -o "$answer" == "Y" ]
then
echo -e "Removing any previous entries of csf..."
rm -fv csf.tgz
echo -e "Downloading Fresh copy of csf files..."
wget http://www.configserver.com/free/csf.tgz
echo -e "Extracting downloaded files..."
tar -xzf csf.tgz
echo -e "Changing the directory for installation..."
cd csf
echo -e "Installation will start now..."
echo `sh install.sh`
if test $? -eq 0
then
echo `perl /etc/csf/csftest.pl`
echo -e $green"CSF has been Successfully Installed."$reset
echo -e "Removing other firewalls iptables.."
echo `sh /etc/csf/remove_apf_bfd.sh`
echo -e $green"Done..."$reset
else
echo -e $red"CSF has been Not Installed Successfully."$reset
fi

elif [ "$answer" == "n" -o "$answer" == "N" ]
then
echo " "
else
echo "Invalid key entered. Aborting the process."
fi;;
4) echo -e "Do you want to proceed with the Auto Configuration of CSF [type y/n]: \c"
read answer
if [ "$answer" == "y" -o "$answer" == "Y" ]
then
if [ -f /etc/csf/csf.conf ]
then
echo -e "Downloading required files from source"
echo -e "`wget -N http://dlscripts.ravikumar.in/csf.conf`"
echo -e "Auto configuring the CSF"
mv /etc/csf/csf.conf /etc/csf/csf.conf.bak
mv csf.conf /etc/csf/csf.conf
/usr/sbin/csf -r
echo -e $green"CSF has been Auto Configured & csf + Ifd has been restarted."$reset
else
echo -e $red"CSF has not Installed yet. You have to install CSF before configuring it."$reset
fi
elif [ "$answer" == "n" -o "$answer" == "N" ]
then
echo " "
else
echo "Invalid key entered. Aborting the process."
fi;;

5) echo -e "Do you want to proceed with the Webmin Installation [type y/n]: \c"
read answer
if [ "$answer" == "y" -o "$answer" == "Y" ]
then
echo "Select the operating system on which you want to install webmin"
echo " 1 - Redhat, Fedora, CentOS, SuSE or Mandrake Linux"
echo " 2 - Debian, Ubuntu or other derived Linux"
echo -e "Enter your choice : \c"
read os

if [ $os == 1 ]
then
yum -y update
cd /root
wget http://prdownloads.sourceforge.net/weba ... noarch.rpm
rpm -U webmin-1.510-1.noarch.rpm
fi



if [ $os == 2 ]
then
apt-get -y update
apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl libmd5-perl
cd /root
wget http://prdownloads.sourceforge.net/weba ... 10_all.deb
dpkg --install webmin_1.510_all.deb
fi
elif [ "$answer" == "n" -o "$answer" == "N" ]
then
echo " "
else
echo "Invalid key entered. Aborting the process."
fi;;

6) echo -e "Do you want to proceed with the Kloxo Installation [type y/n]: \c"
read answer
if [ "$answer" == "y" -o "$answer" == "Y" ]
then
if [ -f /etc/redhat-release ]
then
setenforce 0
wget http://download.lxlabs.com/download/klo ... -master.sh
sh ./kloxo-install-master.sh
fi
elif [ "$answer" == "n" -o "$answer" == "N" ]
then
exit 0
else
echo "Invalid key entered. Aborting the process."
fi;;

7) echo -e "Do you want to Exit from the Installation [type y/n]: \c"
read answer
if [ "$answer" == "y" -o "$answer" == "Y" ]
then
exit 0
elif [ "$answer" == "n" -o "$answer" == "N" ]
then
choice=7
else
echo "Invalid key entered. Aborting the process."
fi;;

*) echo "Invalid Option"
esac
done

Tidak ada komentar:

Posting Komentar