Companion Script #2 for The Perfect Server - Fedora 13 x86_64 [ISPConfig 3]"

Discussion in 'Tips/Tricks/Mods' started by MrCompTech, Jul 10, 2010.

  1. MrCompTech

    MrCompTech New Member

    Script Name: PerfectServer.2.sh

    #!/bin/bash

    clear
    # ====================================================================
    echo "The Perfect Server - Fedora 13 x86_64 [ISPConfig3]"
    echo "Script=PerfectServer.2.sh"
    echo "http://www.howtoforge.org/perfect-server-fedora-13-x86_64-ispconfig3"
    echo " "
    echo "This set of scripts will help you step through the 'How To Forge'"
    echo "how-to 'The Perfect Server - Fedora 13 x86_64 [ISPConfig3]'"
    echo " "
    echo "You can exit the script at many different points but no provision has"
    echo "been made to jump back into the script at any particular place and"
    echo "doing so may have unexpected results. {Ctrl}{c} will also end the"
    echo "script."
    echo " "
    echo "This script makes the assupmtion that when you Are following the"
    echo "beginning portion of the how-to on installing software that"
    echo "during step 3 on page:"
    echo "http://www.howtoforge.com/perfect-server-fedora-13-x86_64-ispconfig-3-p2"
    echo "you UN-SELECT the 'DNS Name Server' in the servers section so that"
    echo "bind-chroot does NOT get installed. BIND will be installed in step"
    echo "17 on page:"
    echo "http://www.howtoforge.com/perfect-server-fedora-13-x86_64-ispconfig-3-p5"
    echo "of the how-to."
    echo " "
    read -p "Press any key to continue." answer
    # ====================================================================
    clear
    echo "To make editing easier you may want to use multiple terminal sessions."
    echo "You can access another terminal session by pressing {Alt}{F2} on your"
    echo "keyboard. Then just login as root again."
    echo " "
    echo "To switch back to this terminal screen press {Alt}{F1}."
    echo "Using this technique you can switch back and forth between a screen"
    echo "that displays information on the changes that you need to make and"
    echo "screen you Are using to make the changes."
    echo " "
    echo "The commands used to make changes will be displayed as part of"
    echo "the script operation in case you want to use another terminal"
    echo "session to make changes."
    echo " "
    read -p "Press any key to continue." answer
    # ====================================================================
    clear
    echo "Here is a tip if you need to transfer files to your ISPConfig3"
    echo "server. The default in stall includes an ftp client for help"
    echo "just type 'man ftp' you can also use wget."
    echo " "
    echo "You can also transfer files using a USB flash drive. After putting"
    echo "the flash drive in your server and waiting a couple of seconds enter"
    echo "the command 'fdisk -l'. The device to mount will be displayed."
    echo " "
    echo "Example: /dev/sdb1"
    echo " "
    echo "To be able to use this drive you need to mount it. Assuming the "
    echo "directory /mnt already exists run the command 'mount /dev/sdb1 /mnt"
    echo "Then you can cd to /mnt to access the files. Before removing the"
    echo "drive you need to unmount it using the command: umount /mnt"
    echo " "
    echo "If you need to lookup info on the net you can use the text-only web"
    echo "browser elinks."
    echo " "
    read -p "Press any key to continue" answer
    # ====================================================================
    clear
    echo "This script starts in the how-to pg 2 where you Are instructed to"
    echo "'check if the installer got your IP address right.'"
    echo " "
    echo "During the runing of the script(s) when asked if you Are ready to"
    echo "continue or proceed and you answer n/N the script operation will be"
    echo "aborted/stopped."
    echo " "
    echo "Standard disclaimer stuff -"
    echo "Use this script(s) at your own risk and by doing so you assume:"
    echo "any and all responsibility for any and all consequences."
    echo " "
    echo "This script is courtesy of [email protected]"
    echo " "
    read -p "Press any key to continue" answer
    # ====================================================================

    clear
    echo "**********************************************************************"
    echo "*** STEP 7 - Check for software Updates"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'yum update' will be run to"
    echo "update your system."
    echo " "
    read -p "Press any key to update your system." answer
    yum update
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "System has been updated, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 7 - Install 'Development Tools'"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'yum groupinstall 'Development Tools''"
    echo "will be run to install the group of 'Development Tools'."
    echo " "
    read -p "Press any key to run 'yum groupinstall 'Development Tools''" answer
    yum groupinstall 'Development Tools'
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Development Tools Are installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 7 - Install 'Development Libraries'"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'yum groupinstall 'Development Libraries''"
    echo "will be run to install the group of 'Development Libraries'."
    echo " "
    read -p "Press any key to run 'yum groupinstall 'Development Libraries''" answer
    yum groupinstall 'Development Libraries'
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Development Libraries Are installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 8 - Install Quota software"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'yum install quota'"
    echo "will be run to install the quota software."
    echo " "
    read -p "Press any key to run 'yum install quota'" answer
    yum install quota
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Quota software is installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 8 - Edit /etc/fstab file"
    echo "**********************************************************************"
    echo " "
    echo "Edit /etc/fstab and add ,usrjquota=aquota.user,grpjquota=aquota.group,"
    echo "jqfmt=vfsv0 to the / partition (/dev/mapper/vg_server1-lv_root):"
    echo " "
    echo "After pressing {enter} you will see an example of the /etc/fstab file."
    echo " "
    read -p "Press any key to see the /etc/fstab example." answer
    echo "======================================================================"
    echo "#"
    echo "# /etc/fstab"
    echo "# Created by anaconda on Mon May 31 16:25:30 2010"
    echo "#"
    echo "# Accessible filesystems, by reference, Are maintained under '/dev/disk'"
    echo "# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info"
    echo "#"
    echo "/dev/mapper/vg_server1-lv_root / ext4 defaults,usrjquot"
    echo "a=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 1 1"
    echo "UUID=732ef9e2-879b-4196-a9e4-95402cf29505 /boot ext4 defaul"
    echo "ts 1 2"
    echo "/dev/mapper/vg_server1-lv_swap swap swap defaults 0 0"
    echo "tmpfs /dev/shm tmpfs defaults 0 0"
    echo "devpts /dev/pts devpts gid=5,mode=620 0 0"
    echo "sysfs /sys sysfs defaults 0 0"
    echo "proc /proc proc defaults 0 0"
    echo "======================================================================"
    echo "After pressing {enter} the command 'vim /etc/fstab' will be run."
    echo "so you can make the neccessary changes."
    echo " "
    read -p "Press to edit the /etc/fstab file." answer
    vim /etc/fstab
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "/etc/fstab has been edited, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 8 - Run a few commands to finish settings up quota"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the following commands will be run to finsh"
    echo "setting up quotas."
    echo " "
    echo " touch /aquota.user /aquota.group"
    echo " chmod 600 /aquota.*"
    echo " mount -o remount /"
    echo " quotacheck -avugm"
    echo " quotaon -avug"
    echo " "
    read -p "Press any key when you are ready to run these commands." answer
    touch /aquota.user /aquota.group
    chmod 600 /aquota.*
    mount -o remount /
    quotacheck -avugm
    quotaon -avug
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Commands have been run to finish quota setup, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 9 Install Apache, MySQL, phpMyAdmin"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'yum' will be run to install:"
    echo " ntp"
    echo " httpd"
    echo " mysql-server"
    echo " php"
    echo " php-mysql"
    echo " php-mbstring"
    echo " php-mcrypt"
    echo " phpMyAdmin"
    echo " "
    read -p "Press any key to run 'yum' and install the above software." answer
    yum install ntp httpd mysql-server php php-mysql php-mbstring php-mcrypt phpMyAdmin
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "software has been installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 10 - Install Dovecot"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'yum install dovecot dovecot-mysql'"
    echo "will be run to install the Dovecot software."
    echo " "
    echo "Additionally the following commands will be run to configure dovecot:"
    echo " rm -fr /usr/lib/dovecot/"
    echo " ln -s /usr/lib64/dovecot/ /usr/lib/dovecot"
    echo " chkconfig --levels 235 dovecot on"
    echo " /etc/init.d/dovecot start"
    echo " "
    read -p "Press any key to run install and configure dovecot." answer
    yum install dovecot dovecot-mysql
    rm -fr /usr/lib/dovecot/
    ln -s /usr/lib64/dovecot/ /usr/lib/dovecot
    chkconfig --levels 235 dovecot on
    /etc/init.d/dovecot start
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Dovecot is installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 11 - Install Postfix"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'yum install postfix'"
    echo "will be run to install the Dovecot software."
    echo " "
    echo "Additionally the following commands will be run to configure postfix:"
    echo " chkconfig --levels 235 mysqld on"
    echo " /etc/init.d/mysqld start"
    echo " chkconfig --levels 235 sendmail off"
    echo " chkconfig --levels 235 postfix on"
    echo " /etc/init.d/sendmail stop"
    echo " /etc/init.d/postfix start"
    echo " "
    read -p "Press any key to run install and configure postfix." answer
    yum install postfix
    chkconfig --levels 235 mysqld on
    /etc/init.d/mysqld start
    chkconfig --levels 235 sendmail off
    chkconfig --levels 235 postfix on
    /etc/init.d/sendmail stop
    /etc/init.d/postfix start
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Postfix is installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 7 - Install Getmail"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'yum install getmail'"
    echo "will be run."
    echo " "
    read -p "Press any key to run 'yum install getmail'" answer
    yum install getmail
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Getmail is installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 13 Secure MySQL"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'mysql_secure_installation'"
    echo "will be run."
    echo " "
    read -p "Press any key to run 'mysql_secure_installation'" answer
    mysql_secure_installation
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Getmail is installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 13 Configure phpMyAdmin"
    echo "**********************************************************************"
    echo " "
    echo "Now we configure phpMyAdmin. We change the Apache configuration so that"
    echo "phpMyAdmin allows connections not just from localhost by commenting out"
    echo "the stanza <Directory /usr/shAre/phpMyAdmin/>."
    echo " "
    echo "Example:"
    echo "======================================================================"
    echo "# phpMyAdmin - Web based MySQL browser written in php"
    echo "..."
    echo "#<Directory /usr/shAre/phpMyAdmin/>"
    echo "# order deny,allow"
    echo "# deny from all"
    echo "# allow from 127.0.0.1"
    echo "# allow from ::1"
    echo "#</Directory>"
    echo "..."
    echo "======================================================================"
    echo "After pressing {enter} the command 'vim /etc/httpd/conf.d/phpMyAdmin.conf'"
    echo " will be run so you can make the neccessary changes."
    echo " "
    read -p "Press to edit the /etc/httpd/conf.d/phpMyAdmin.conf." answer
    vim /etc/httpd/conf.d/phpMyAdmin.conf
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "phpMyAdmin.conf has been edited, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 13 - Configure httpd to start"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} commands will be run to configure Apache."
    echo " "
    echo "Additionally the following commands will be run to configure postfix:"
    echo " chkconfig --levels 235 httpd on"
    echo " /etc/init.d/httpd start"
    echo " "
    read -p "Press any key to configure Apache." answer
    chkconfig --levels 235 httpd on
    /etc/init.d/httpd start
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Apache has been configured to start, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 13 - Confirm phpMyAdmin works"
    echo "**********************************************************************"
    echo " "
    echo "Now you can direct your browser to http://server1.example.com/phpmyadmin/"
    echo "or http://192.168.0.100/phpmyadmin/ and log in with the user name root"
    echo "and your new root MySQL password."
    echo " "
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "phpMyAdmin has been tested, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 14 Install Amavisd-new, SpamAssassin And ClamAV"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'yum' will be run to install:"
    echo " amavisd-new"
    echo " spamassassin"
    echo " clamav"
    echo " clamav-data"
    echo " clamav-server"
    echo " clamav-update"
    echo " unzip"
    echo " bzip2"
    echo " perl-DBD-mysql"
    echo " "
    read -p "Press any key to run 'yum' and install the above software." answer
    yum install amavisd-new spamassassin clamav clamav-data clamav-server clamav-update unzip bzip2 perl-DBD-mysql
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "software has been installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 14 Configure freshclam"
    echo "**********************************************************************"
    echo " "
    echo "When we installed ClamAV, a cron job got installed that tries to update"
    echo "the ClamAV virus database every three hours. But this works only if we"
    echo "enable it in /etc/sysconfig/freshclam and /etc/freshclam.conf."
    echo " "
    echo "Comment out the FRESHCLAM_DELAY line at the end:"
    echo " "
    echo "After pressing {enter} the command 'vim /etc/sysconfig/freshclam'"
    echo "will be run so you can make the neccessary changes."
    echo " "
    read -p "Press any key to edit the /etc/sysconfig/freshclam file." answer
    vim /etc/sysconfig/freshclam
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "freshclam has been edited, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 14 Configure freshclam.conf"
    echo "**********************************************************************"
    echo " "
    echo "When we installed ClamAV, a cron job got installed that tries to update"
    echo "the ClamAV virus database every three hours. But this works only if we"
    echo "enable it in /etc/sysconfig/freshclam and /etc/freshclam.conf."
    echo " "
    echo "Comment out the Example line:"
    echo " "
    echo "After pressing {enter} the command 'vim /etc/freshclam.conf'"
    echo "will be run so you can make the neccessary changes."
    echo " "
    read -p "Press any key to edit the /etc/freshclam.conf file." answer
    vim /etc/freshclam.conf
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "freshclam.conf has been edited, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 14 - Configure Amavisd-new, SpamAssassin And ClamAV"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the commands will be run to configure"
    echo "Amavisd-new, SpamAssassin And ClamAV:"
    echo " "
    echo " sa-update "
    echo " chkconfig --levels 235 amavisd on"
    echo " chkconfig --levels 235 clamd.amavisd on"
    echo " /usr/bin/freshclam"
    echo " /etc/init.d/amavisd start"
    echo " /etc/init.d/clamd.amavisd start"
    echo " rm -f /var/spool/amavisd/clamd.sock"
    echo " mkdir /var/run/clamav.amavisd /var/run/clamd.amavisd"
    echo " chown amavis /var/run/clamav.amavisd"
    echo " chown amavis /var/run/clamd.amavisd"
    echo " ln -sf /var/spool/amavisd/clamd.sock /var/run/clamav.amavisd/clamd.sock"
    echo " ln -sf /var/spool/amavisd/clamd.sock /var/run/clamd.amavisd/clamd.sock"
    echo " /etc/init.d/clamd.amavisd restart"
    echo " "
    read -p "Press any key to configure Amavisd-new, SpamAssassin And ClamAV." answer
    sa-update
    chkconfig --levels 235 amavisd on
    chkconfig --levels 235 clamd.amavisd on
    /usr/bin/freshclam
    /etc/init.d/amavisd start
    /etc/init.d/clamd.amavisd start
    rm -f /var/spool/amavisd/clamd.sock
    mkdir /var/run/clamav.amavisd /var/run/clamd.amavisd
    chown amavis /var/run/clamav.amavisd
    chown amavis /var/run/clamd.amavisd
    ln -sf /var/spool/amavisd/clamd.sock /var/run/clamav.amavisd/clamd.sock
    ln -sf /var/spool/amavisd/clamd.sock /var/run/clamd.amavisd/clamd.sock
    /etc/init.d/clamd.amavisd restart
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Antivirus has been configured, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 15 Installing mod_php, mod_fcgi/PHP5, And suPHP"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'yum' will be run to install:"
    echo " php php-devel php-gd php-imap"
    echo " php-ldap php-mysql php-odbc php-pear"
    echo " php-xml php-xmlrpc php-eaccelerator php-mbstring"
    echo " php-mcrypt php-mhash php-mssql php-snmp"
    echo " php-soap php-tidy curl curl-devel"
    echo " perl-libwww-perl ImageMagick libxml2 libxml2-devel"
    echo " mod_fcgid php-cli httpd-devel"
    echo " "
    read -p "Press any key to run 'yum' and install the above software." answer
    yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-mbstring php-mcrypt php-mhash php-mssql php-snmp php-soap php-tidy curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel mod_fcgid php-cli httpd-devel
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "software has been installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 15 Configure php.ini"
    echo "**********************************************************************"
    echo " "
    echo "ISPConfig 3 allows you to use mod_php, mod_fcgi/PHP5, cgi/PHP5, "
    echo "and suPHP on a per website basis. We need to configure php and "
    echo "change the error reporting (so that notices Aren't shown any "
    echo "longer) and add cgi.fix_pathinfo = 1 at the end of the file"
    echo " "
    echo "In vim you can use the slash / to search for text such as"
    echo "error_reporting = "
    echo " "
    echo "You Are looking for a line such as:"
    echo "error_reporting = E_ALL & ~E_DEPRECATED"
    echo "and change it to: error_reporting = E_ALL & ~E_NOTICE"
    echo " "
    echo "Also the line cgi.fix_pathinfo = 1 maybe present but be commented out"
    echo ", remove the comment."
    echo " "
    echo "After pressing {enter} the command 'vim /etc/php.ini'"
    echo "will be run so you can make the neccessary changes."
    echo " "
    read -p "Press any key to edit the /etc/php.ini file." answer
    vim /etc/php.ini
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "/etc/php.ini has been edited, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 15 Install and configure suPHP"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the commands will be run to install and configure"
    echo "suPHP:"
    echo " "
    echo " cd /tmp"
    echo " wget http://www.suphp.org/download/suphp-0.7.1.tar.gz"
    echo " tar xvfz suphp-0.7.1.tar.gz"
    echo " cd suphp-0.7.1/"
    echo " ./configure ..."
    echo " make"
    echo " make install"
    echo " The file /etc/httpd/conf.d/suphp.conf will be created."
    echo " The file /etc/suphp.conf will be created."
    echo " /etc/init.d/httpd restart"
    echo " "
    read -p "Press any key to install and configure suPHP." answer
    cd /tmp
    wget http://www.suphp.org/download/suphp-0.7.1.tar.gz
    tar xvfz suphp-0.7.1.tar.gz
    cd suphp-0.7.1/
    ./configure --prefix=/usr --sysconfdir=/etc --with-apr=/usr/bin/apr-1-config --with-apxs=/usr/sbin/apxs --with-apache-user=apache --with-setid-mode=owner --with-php=/usr/bin/php-cgi --with-logfile=/var/log/httpd/suphp_log --enable-SUPHP_USE_USERGROUP=yes
    make
    make install
    echo "Creating the file /etc/httpd/conf.d/suphp.conf"
    echo "LoadModule suphp_module modules/mod_suphp.so" >> /etc/httpd/conf.d/suphp.conf
    echo "Creating the file /etc/suphp.conf"
    echo "[global]" >> /etc/suphp.conf
    echo ";Path to logfile" >> /etc/suphp.conf
    echo "logfile=/var/log/httpd/suphp.log" >> /etc/suphp.conf
    echo " " >> /etc/suphp.conf
    echo ";Loglevel" >> /etc/suphp.conf
    echo "loglevel=info" >> /etc/suphp.conf
    echo " " >> /etc/suphp.conf
    echo ";User Apache is running as" >> /etc/suphp.conf
    echo "webserver_user=apache" >> /etc/suphp.conf
    echo " " >> /etc/suphp.conf
    echo ";Path all scripts have to be in" >> /etc/suphp.conf
    echo "docroot=/" >> /etc/suphp.conf
    echo " " >> /etc/suphp.conf
    echo ";Path to chroot() to before executing script" >> /etc/suphp.conf
    echo ";chroot=/mychroot" >> /etc/suphp.conf
    echo " " >> /etc/suphp.conf
    echo "; Security options" >> /etc/suphp.conf
    echo "allow_file_group_writeable=true" >> /etc/suphp.conf
    echo "allow_file_others_writeable=false" >> /etc/suphp.conf
    echo "allow_directory_group_writeable=true" >> /etc/suphp.conf
    echo "allow_directory_others_writeable=false" >> /etc/suphp.conf
    echo " " >> /etc/suphp.conf
    echo ";Check wheter script is within DOCUMENT_ROOT" >> /etc/suphp.conf
    echo "check_vhost_docroot=true" >> /etc/suphp.conf
    echo " " >> /etc/suphp.conf
    echo ";Send minor error messages to browser" >> /etc/suphp.conf
    echo "errors_to_browser=false" >> /etc/suphp.conf
    echo " " >> /etc/suphp.conf
    echo ";PATH environment variable" >> /etc/suphp.conf
    echo "env_path=/bin:/usr/bin" >> /etc/suphp.conf
    echo " " >> /etc/suphp.conf
    echo ";Umask to set, specify in octal notation" >> /etc/suphp.conf
    echo "umask=0077" >> /etc/suphp.conf
    echo " " >> /etc/suphp.conf
    echo "; Minimum UID" >> /etc/suphp.conf
    echo "min_uid=100" >> /etc/suphp.conf
    echo " " >> /etc/suphp.conf
    echo "; Minimum GID" >> /etc/suphp.conf
    echo "min_gid=100" >> /etc/suphp.conf
    echo " " >> /etc/suphp.conf
    echo "[handlers]" >> /etc/suphp.conf
    echo ";Handler for php-scripts" >> /etc/suphp.conf
    echo "x-httpd-suphp="php:/usr/bin/php-cgi"" >> /etc/suphp.conf
    echo " " >> /etc/suphp.conf
    echo ";Handler for CGI-scripts" >> /etc/suphp.conf
    echo "x-suphp-cgi="execute:!self"" >> /etc/suphp.conf
    echo ""
    echo "Restarting Apache"
    /etc/init.d/httpd restart
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "suPHP has been installed & configured, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 16 Install PureFTPd"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'yum install Pure-FTPd' will be run"
    echo "to install Pure-FTPd and additionally a couple commands will be run to"
    echo "configure it."
    echo " "
    echo "Additional commands to be run:"
    echo " chkconfig --levels 235 pure-ftpd on"
    echo " chkconfig --levels 235 pure-ftpd on"
    echo " "
    read -p "Press any key to install and configure pure-ftpd" answer
    yum install pure-ftpd
    chkconfig --levels 235 pure-ftpd on
    /etc/init.d/pure-ftpd start
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Development Tools Are installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 17 Install BIND"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'yum install bind bind-utils' will"
    echo " be run to install BIND and an additional command to configure it."
    echo " "
    echo "Additional command to be run:"
    echo " chkconfig --levels 235 named on"
    echo " "
    read -p "Press any key to install and configure BIND" answer
    yum install bind bind-utils
    chkconfig --levels 235 named on
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Development Tools Are installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 18 Install Vlogger And Webalizer"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the following commands will be run to install and"
    echo "configure Vlogger And Webalizer:"
    echo " "
    echo " yum install webalizer perl-DateTime-Format-HTTP perl-DateTime-Format-Builder"
    echo " cd /tmp"
    echo " wget http://n0rp.chemlab.org/vlogger/vlogger-1.3.tar.gz"
    echo " tar xvfz vlogger-1.3.tar.gz"
    echo " mv vlogger-1.3/vlogger /usr/sbin/"
    echo " rm -rf vlogger*"
    echo " "
    read -p "Press any key to install and configure Vlogger and Webalizer." answer
    yum install webalizer perl-DateTime-Format-HTTP perl-DateTime-Format-Builder
    cd /tmp
    wget http://n0rp.chemlab.org/vlogger/vlogger-1.3.tar.gz
    tar xvfz vlogger-1.3.tar.gz
    mv vlogger-1.3/vlogger /usr/sbin/
    rm -rf vlogger*
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Vlogger and Webalizer are installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 19 Install Jailkit"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the following commands will be run to install and"
    echo "configure jailkit:"
    echo " "
    echo " cd /tmp"
    echo " wget http://olivier.sessink.nl/jailkit/jailkit-2.11.tar.gz"
    echo " tar xvfz jailkit-2.11.tar.gz"
    echo " cd jailkit-2.11"
    echo " ./configure"
    echo " make"
    echo " make install"
    echo " cd .."
    echo " rm -rf jailkit-2.11*"
    echo " "
    read -p "Press any key to install and configure Jailkit." answer
    cd /tmp
    wget http://olivier.sessink.nl/jailkit/jailkit-2.11.tar.gz
    tar xvfz jailkit-2.11.tar.gz
    cd jailkit-2.11
    ./configure
    make
    make install
    cd ..
    rm -rf jailkit-2.11*
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Jailkit is installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 20 Fail2Ban"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the following commands will be run to install and"
    echo "configure Fail2Ban:"
    echo " "
    echo " yum install fail2ban"
    echo " chkconfig --levels 235 fail2ban on"
    echo " /etc/init.d/fail2ban start"
    echo " "
    read -p "Press any key to install and configure Fail2Ban." answer
    yum install fail2ban
    chkconfig --levels 235 fail2ban on
    /etc/init.d/fail2ban start
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Fail2Ban is installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 21 Install RKHunter"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the following command will be run to install"
    echo "RKHunter:"
    echo " "
    echo " yum install rkhunter"
    echo " "
    read -p "Press any key to install and configure RKHunter." answer
    yum install rkhunter
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "RKHunter is installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 22 Install SquirrelMail"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the following command will be run to install"
    echo "SquirrelMail:"
    echo " "
    echo " yum install squirrelmail"
    echo " /etc/init.d/httpd restart"
    echo " "
    read -p "Press any key to install SquirrelMail." answer
    yum install squirrelmail
    /etc/init.d/httpd restart
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "SquirrelMail is installed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 22 Configure SquirrelMail"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the following command will be run to configure"
    echo "SquirrelMail:"
    echo " "
    echo " /usr/share/squirrelmail/config/conf.pl"
    echo " "
    read -p "Press any key to configure SquirrelMail." answer
    /usr/share/squirrelmail/config/conf.pl
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "SquirrelMail has been configured, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 22 - Edit SquirrelMail config file"
    echo "**********************************************************************"
    echo " "
    echo "One last thing we need to do is modify the file:"
    echo " "
    echo "/etc/squirrelmail/config_local.php"
    echo " "
    echo "and comment out the 'default_folder_prefix' variable - if you don't do"
    echo "this, you will see the following error message in SquirrelMail after"
    echo "you've logged in:"
    echo " "
    echo "Query: CREATE "Sent" Reason Given: Invalid mailbox name."
    echo " "
    echo "Example: NOTE: the variable will be proceeded by a $."
    echo " //default_folder_prefix = '';"
    echo " "
    read -p "Press any key to edit the config_local.php file." answer
    vim /etc/squirrelmail/config_local.php
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "config_local.php has been changed, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 22 - Confirm SquirrelMail works"
    echo "**********************************************************************"
    echo " "
    echo "Now you can direct your browser to http://server1.example.com/webmail/"
    echo "or http://192.168.0.100/webmail/ to test that SquirrelMail works."
    echo " "
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "SquirrelMail has been tested, so going to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 23 Install ISPConfig3"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the following commands will be run to install and"
    echo "configure ISPConfig3:"
    echo " "
    echo " cd /tmp"
    echo " wget http://downloads.sou ... /ISPConfig-3.0.2.1.tar.gz?use_mirror="
    echo " tar xvfz ISPConfig-3.0.2.1.tar.gz"
    echo " cd ispconfig3_install/install/"
    echo " php -q install.php"
    echo " "
    read -p "Press any key to install and configure ISPConfig3." answer
    cd /tmp
    wget http://downloads.sourceforge.net/ispconfig/ISPConfig-3.0.2.1.tar.gz?use_mirror=
    tar xvfz ISPConfig-3.0.2.1.tar.gz
    cd ispconfig3_install/install/
    php -q install.php
    clear
    echo " "
    echo " "
    echo " "
    echo " "
    echo " "
    read -p "That's it! and your glad your finished, I'm sure!" answer
    echo " "
    echo " "
    echo "If you find this script helpful or have any suggestions send feedback "
    echo "to mrcomptech at yahoo dot com"
    echo " "
     

Share This Page