Install JDK Java Apache Tomcat MySQL script in Ubuntu 10.4 offline

Source: Internet
Author: User

Main. Sh

!/bin/bashCURRENT_PATH=$PWDlog_path=$CURRENT_PATH"/log"log_file=$log_path"/main.log"soft_path=$CURRENT_PATH"/CpsInstaller"cps_path="/home/cps"apache_path="/home/cps/apache"resource_path="/home/cps/resource"echo $log_pathecho $log_fileecho $soft_pathecho $cps_pathecho $apache_path#create log folder and log filecreate_log(){    echo "Start to create log folder..."    if [ -d "$log_path" ]; then        rm -rf  $log_path        mkdir $log_path    else        mkdir $log_path    fi    echo "Create log folder successfully"    echo "Start to create log file..."    if [ ! -f "$log_file" ]; then        touch "$log_file"    fi    echo "Create log file successfully"}#create cps foldercreate_cps_folder(){    echo "Start to create cps folder..."    if [ -d "$cps_path" ]; then        rm -rf  $cps_path        mkdir $cps_path    else        mkdir $cps_path    fi    echo "Create cps folder successfully"}#create apache foldercreate_apache_folder(){    echo "Start to create apache folder..."    if [ -d "$apache_path" ]; then        rm -rf $apache_path        mkdir $apache_path    else        mkdir $apache_path    fi    echo "Create apache folder successfully"    echo "Start to create resource folder..."    if [ -d "$resource_path" ]; then        rm -rf $resource_path        mkdir $resource_path    else        mkdir $resource_path    fi    echo "Create resource folder successfully"}#tar CpsInstaller.tartar_file(){    echo "Start to unzip CpsInstaller.tar..."    tar -xvf CpsInstaller.tar    echo "Unzip CpsInstaller.tar successfully"    echo "Current folder files list:"    ls -l}#install Javainstall_java(){    echo "Start to install Java..."    chmod u+x $soft_path"/jdk1.6.0_35.tar"    cp -a $soft_path"/jdk1.6.0_35.tar" /opt    cd /opt    tar -xvf jdk1.6.0_35.tar    echo "Install Java successfully"    #   rm -f /opt/jdk-6u35-linux-i586.bin  }#config java pathconfig_javapath(){    echo "Start to configure Java environment..."    echo 'export JAVA_HOME="/opt/jdk1.6.0_35"' >> /etc/profile    echo 'export JRE_HOME=$JAVA_HOME"/jre"' >> /etc/profile    echo 'export CLASSPATH=$CLASSPATH:$JAVA_HOME"/lib":$JRE_HOME"/lib"' >> /etc/profile    echo 'export PATH=$PATH:$JAVA_HOME"/bin":$JRE_HOME"/bin"' >> /etc/profile    echo "Configure Java environment successfully, it will work after system reboot!"    #source "/etc/profile"}#unzip httpd-2.2.23.tar.gztar_apache(){    echo "Start to unzip Apache..."    chmod u+x $soft_path"/httpd-2.2.23.tar.gz"    cp -a $soft_path"/httpd-2.2.23.tar.gz" $cps_path    cd $cps_path    echo "Current path:`pwd`"    tar -xvf httpd-2.2.23.tar.gz    echo "unzip apache successfully"#    rm -f /opt/httpd-2.2.23.tar.gz}#pre apachepre_apache(){    echo "Start to pre-configure apache..."    cd "$cps_path/httpd-2.2.23"    echo "Current path is : `pwd`"    ./configure --prefix="$apache_path" --enable-shared=max --enable-module=rewrite --enable-module=so    echo "Pre-Configure apache successfully"}#compile apachecompile_apache(){    echo "Start to compile apache..."    cd "$cps_path/httpd-2.2.23"    echo "Current path is : `pwd`"    make    echo "Compile apache successfully"}#install apacheinstall_apache(){echo "Start to install apache..."    cd "$cps_path/httpd-2.2.23"    echo "Current path is : `pwd`"    make install    echo "Install apache successfully"}#start apache servicestart_apache(){    echo "Start to start apache service..."    ctlfile = "/etc/init.d/httpd"    if [ ! -f "$ctlfile" ]; then        cp "$apache_path/bin/apachectl" /etc/init.d/httpd    else        rm /etc/init.d/httpd -r    fi    service httpd start    echo "Compile apache successfully"}#unzip tomcatinstall_tomcat(){    echo "Start to install tomcat..."#    cd $soft_path#    echo "Current path is : `pwd`"    tar -xvf $soft_path/apache-tomcat-6.0.35.tar.gz -C $cps_path echo "Install tomcat successfully"}#mainmain(){    echo "Start to install cps..."    echo "*************************************************"    echo "*****                 WARNING               *****"    echo "*****  Please must not close this window!   *****"    echo "*************************************************"#    tar_file && install_java && config_javapath#    tar_file && install_apache##    install_tomcat#    create_log && create_cps_folder && create_apache_folder && tar_apache && pre_apache && compile_apache && install_apache && start_apache}#    create_log && create_cps_folder && create_apache_folder && tar_apache && pre_apache && compile_apache && install_apache && start_apachemain |tee -a $log_fileexit
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.