Results 1 to 4 of 4

Thread: Simple Bash script for server preperation CentOS.

  1. #1
    Tux.Ice is offline Intermediate Member
    Join Date
    Sep 2009
    Posts
    20
    Rep Power
    5

    Default Simple Bash script for server preperation CentOS.

    This simple script will do basic things such as set a hostname, the ZCS license, the hosts file, and download extract and start the zimbra installer on CentOS.

    Hosts file should be in same directory as hosts.conf
    License should be in same directory as license.xml

    Code:
    if [[ $EUID -ne 0 ]]; then
       echo -e "\e[1;31mThis script must be run as root or it will fail\e[0m" 1>&2
       exit 1
    fi
    
    echo "Zimbra Auto Server Preperation Script 1.0"
    echo " "
    echo "---"
    echo "This script will prepare this server for Zimbra 6.0.2, and will start the installation. Please read the documentation!"
    echo ""
    echo -e "\e[1;32mYes will be assumed to answers, and will be defaulted. 'n' or 'no' will result in a No answer, anything else will be a yes.\e[0m"
    echo ""
    echo -e "\e[1;31mThis script MUST be run as root or it will fail\e[0m"
    echo "---"
    echo "Start Installation? (Y/n)"
    read start
    
    if [ $start == "n" ] || [ $start == "no" ]; then
    echo "Exiting..."
    exit 1
    fi
    
    # Check if the OS matches Red hat or CentOS
    OS=`cat /etc/redhat-release | awk {'print $1}'`
    if [ "$OS" != "CentOS" ]
    then
    echo -e "\e[1;31mSystem runs on something other than CentOS. This may not work!\e[0m";
    echo -e "\e[1;31mContinue Anyway? (y/n)\e[0m"
    read cont
    if [ $cont == "n" ] || [ $cont == "no"]; then
    echo "Exiting..."
    exit 1
    fi
    
    fi
    
    echo -e "\e[1;32mOkay. Vee one. Do not go back now.\e[0m"
    echo -e "\e[1;33m-----------------------!!!-----------------------\e[0m"
    echo "Updating System..."
    yum update * -y > yum_update.log
    echo "Installing Prerequisites..."
    yum install wget gmp compat-libstdc++-33 sysstat libidn sudo -y > yum_prerequisite.log
    
    echo -e "\e[1;31mWhat should the hostname be of this machine?\e[0m"
    read host
    hostname $host
    echo "Hostname set. Continuing..."
    echo "Downloading Zimbra..."
    cd /tmp
    echo -e "\e[1;31mVersion of Zimbra? [Network Edition (Needs license) or Free open source software (Foss)] (N/F)\e[0m"
    read version
    if [ $version == "F" ]; then
    echo "FOSS Version selected"
    wget http://h.yimg.com/lo/downloads/6.0.4_GA/zcs-6.0.4_GA_2038.RHEL5.20091214191028.tgz > wget_zcs.log
    fi
    if [ $version == "N" ]; then
    echo "Network version selected"
    wget http://h.yimg.com/lo/downloads/6.0.4_GA/zcs-NETWORK-6.0.4_GA_2038.RHEL5.20091214172206.tgz > wget_zcs.log
    fi
    echo "Extracting & Cleaning up..."
    tar xfz zcs* > tar_zcs.log
    rm -rf zcs*tgz > rm_zcs.log
    
    echo "Cleaned up. If you select to continue at this point, you will be handed over to the Zimbra installation wizard, and this wizard will exit."
    echo "---"
    echo -e "\e[1;31mContinue? (Y/n)\e[0m"
    read conti
    if [ $conti == "n" ] || [ $conti == "no" ]; then
    echo "Exiting..."
    exit 1
    fi
    echo "Setting hosts and license."
    cp hosts.conf /etc/hosts
    cp license.xml /etc/ZCSLicense.xml
    cd zcs*
    echo "Copied. Rotation. Here comes Zimbra."
    sh install.sh --platform-override -l /etc/ZCSLicense.xml
    Last edited by Tux.Ice; 01-10-2010 at 09:01 AM.

  2. #2
    jummo is offline Special Member
    Join Date
    May 2009
    Location
    Bremen, Germany
    Posts
    122
    Rep Power
    6

    Default

    Thanks man.

  3. #3
    Tux.Ice is offline Intermediate Member
    Join Date
    Sep 2009
    Posts
    20
    Rep Power
    5

    Default Updated

    Updated for CentOS 5.4 and Zimbra 6.0.4 GA.

  4. #4
    uxbod's Avatar
    uxbod is offline Moderator
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,017
    Rep Power
    24

    Default

    You could also check if iptables and selinux have been disabled ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Bash Script Help
    By clayway in forum Administrators
    Replies: 2
    Last Post: 03-12-2009, 08:25 PM
  2. Zimbra Open Source Backup Help
    By ayush1440 in forum Administrators
    Replies: 8
    Last Post: 11-13-2008, 04:56 AM
  3. how to launch a (bash) script at user login?
    By shadowscheme in forum Administrators
    Replies: 4
    Last Post: 11-04-2007, 05:13 AM
  4. Replies: 0
    Last Post: 10-31-2007, 07:22 AM
  5. Zimbra startup hangs after install CentOS 4.2
    By eger in forum Installation
    Replies: 4
    Last Post: 02-10-2006, 11:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •