Companion Script #1 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

    Name of Script "PerfectServer.1.sh"

    #!/bin/bash

    clear
    # ====================================================================
    echo "The Perfect Server - Fedora 13 x86_64 [ISPConfig3]"
    echo "Script=PerfectServer.1.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 mrcomptech at yahoo dot com"
    echo " "
    read -p "Press any key to continue" answer
    # ====================================================================

    clear
    echo "**********************************************************************"
    echo "*** STEP 3A - Check if the installer got your IP address right"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'ifconfig | more' will be run to"
    echo "display your IP address(es). If you need to change your IP address"
    echo "Respond with n/N to run 'system-config-network' to make changes."
    echo " "
    read -p "Press any key to view ifconfig output" answer
    ifconfig | more
    answer=""
    while [ -z $answer ]
    do
    read -p "Is your IP address correct? (yY/nN)" answer
    case $answer in
    y|Y) echo "IP address is correct, so going to continue on ...";;
    n|N) system-config-network;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 3B - Disable Fedora's Network Manager."
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'chkconfig NetworkManager off' will be"
    echo "run to disable Fedora's Network Manager."
    echo " "
    read -p "Press any key to disable NetworkManager." answer
    chkconfig NetworkManager off
    answer=""
    while [ -z $answer ]
    do
    read -p "The Network Manger has been disabled, ready to proceed? (yY/nN)" answer
    case $answer in
    y|Y) echo "Network Manger has been disabled, continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 3C - Enable 'normal' networking"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'chkconfig --levels 35 network on' will be"
    echo "run to enable 'normal' networking."
    echo " "
    read -p "Press any key to enable normal networking." answer
    chkconfig --levels 35 network on
    answer=""
    while [ -z $answer ]
    do
    read -p "Normal networking has been enabled, ready to proceed? (yY/nN)" answer
    case $answer in
    y|Y) echo "Network Manger has been disabled, continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 3D - Restart networking"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command '/etc/init.d/network restart' will be"
    echo "run to restart networking."
    echo " "
    read -p "Press any key to restart networking." answer
    /etc/init.d/network restart
    answer=""
    while [ -z $answer ]
    do
    read -p "Networking has been restarted, ready to proceed? (yY/nN)" answer
    case $answer in
    y|Y) echo "Network Manger has been disabled, continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 3E - Check if your name servers are correct"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'cat /etc/resolv.conf | more' will be"
    echo "run to display your name servers. If you need to change your name"
    echo "servers respond with n/N to run 'system-config-network' to make changes."
    echo " "
    read -p "Press any key to view your name servers." answer
    cat /etc/resolv.conf
    answer=""
    while [ -z $answer ]
    do
    read -p "Are your name servers correct? (yY/nN)" answer
    case $answer in
    y|Y) echo "Name servers are correct, continue on ...";;
    n|N) system-config-network;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 4 - Adjust the /etc/hosts file"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'cat /etc/hosts | more' will be"
    echo "run to display your /etc/hosts file."
    echo " "
    echo "You will need to make changes:"
    echo "Remove the entry for the server name from the 127.0.0.1 line"
    echo "Then add a line for the server"
    echo " "
    echo "Example:"
    echo "127.0.0.1 localhost.localdomain localhost"
    echo "192.168.0.100 server1.example.com server1"
    echo "::1 localhost localhost.localdomain localhost6 localhost6.localdomain6"
    echo " "
    read -p "Press any key to view your /etc/hosts file." answer
    cat /etc/hosts | more
    answer=""
    while [ -z $answer ]
    do
    read -p "Is your /etc/hosts file correct? (yY/nN)" answer
    case $answer in
    y|Y) echo "/etc/hosts file is correct, continue on ...";;
    n|N) vim /etc/hosts;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 5 Configure the firewall"
    echo "**********************************************************************"
    echo " "
    echo "If you have followed the recommended settings in the How-To"
    echo "then you have already disabled the firewall."
    echo "If you have not disabled the firewall answer n/N to the next question"
    echo "and the system-config-firewall utility will start so that you can"
    echo "disable the firewall, which is the recommended setting since"
    echo "since ISPConfig3 will install it's own firewall."
    echo " "
    answer=""
    while [ -z $answer ]
    do
    read -p "Have you you disabled the linux firewall? (yY/nN)" answer
    case $answer in
    y|Y) echo "Firewall is disabled, continue on ...";;
    n|N) system-config-firewall;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** STEP 5 Check to see that the firewall has been disabled"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'iptables -l' will be"
    echo "run to display the firewall rules."
    echo " "
    echo "Your iptables should look like this:"
    echo "===================================================="
    echo "Chain INPUT (policy ACCEPT)"
    echo "target prot opt source destination"
    echo " "
    echo "Chain FORWARD (policy ACCEPT)"
    echo "target prot opt source destination"
    echo " "
    echo "Chain OUTPUT (policy ACCEPT)"
    echo "target prot opt source destination"
    echo "===================================================="
    echo " "
    read -p "Press any key to view your firewall rules." answer
    iptables -L
    echo " "
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to continue? (yY/nN)" answer
    case $answer in
    y|Y) echo "Ready to continue on ...";;
    n|N) exit;;
    *) answer="";;
    esac
    done

    clear
    echo "**********************************************************************"
    echo "*** 6 Disable SELinux"
    echo "**********************************************************************"
    echo " "
    echo "After pressing {enter} the command 'cat /etc/selinux/config | more'"
    echo "will be run to display the /etc/selinux/config file."
    echo " "
    echo "Edit /etc/selinux/config and set SELINUX=disabled:"
    echo " "
    read -p "Press any key to view the /etc/selinux/config file." answer
    cat /etc/selinux/config | more
    echo " "
    answer=""
    while [ -z $answer ]
    do
    read -p "Have you you disabled selinux? (yY/nN)" answer
    case $answer in
    y|Y) echo "SELinux is disabled, continue on ...";;
    n|N) vim /etc/selinux/config;;
    *) answer="";;
    esac
    done

    clear
    clear
    echo "**********************************************************************"
    echo "*** Step 6 SELinux is now disabled a restart is required."
    echo "**********************************************************************"
    echo " "
    echo "Since SELinux is now disabled a restart is required."
    echo " "
    answer=""
    while [ -z $answer ]
    do
    read -p "Are you ready to restart your system? (yY/nN)" answer
    case $answer in
    y|Y) reboot;;
    n|N) echo "Exiting script - don't forget to restart your system";;
    *) answer="";;
    esac
    done
     

Share This Page