Chinaunix首页 | 论坛 | 博客
  • 博客访问: 708432
  • 博文数量: 112
  • 博客积分: 3889
  • 博客等级: 少校
  • 技术积分: 1448
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-19 16:35
个人简介

追求卓越,成功就会在不经意间追上你

文章分类

全部博文(112)

文章存档

2015年(1)

2014年(2)

2013年(1)

2012年(16)

2011年(86)

2010年(6)

分类: Python/Ruby

2011-10-14 16:57:15

刚整好的APACHE安装自行安装脚本,在自己的机器(centos5.6_x86)上测试成功了.在这里跟大家分享下,脚本写的不咋的,热烈欢迎各位拍砖!!!嘿嘿



#!/bin/bash
#
#Desc : install apache tarball
#
#Creator : xiaozhenggang
#
#Date : 2011/10/13
#
#
#Update : 2011/10/14
#
#



PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
export PATH

TAR_HOME=/home/centos/src
APACHE_HOME=/usr/local/apache

#Downloading apache
cd $TAR_HOME
echo -e "\033[33m Starting download \033[0m"
wget
#echo -e "\033[33m Download Ended \033[0m"

if [ $? -eq 0 ];then

   echo -e "\033[33m Uncompress httpd \033[0m"
   tar -xzvf httpd-2.2.21.tar.gz
   echo -e "\033[33m Uncompress Ended \033[0m"
   echo ""
   echo ""

   cd httpd-2.2.21
   echo -e "\033[33m Starting configuration \033[0m"
   ./configure --prefix=$APACHE_HOME --enable-so --enable-rewrite --enable-mods-shared=most
   echo -e "\033[33m Configurate Ended \033[0m"
   echo ""
   echo ""

   echo -e "\033[33m Starting  complie and install\033[0m"
   sudo make && sudo make install
   echo -e "\033[33m Ended complie and install \033[0m"
   echo ""
   echo ""


   echo -e "\033[33m Copy apachectl as httpd and add apache as a system service\033[0m"
   sudo cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
   sudo /sbin/chkconfig --add httpd
   sudo /sbin/chkconfig httpd on

   echo -e "\033[33m Add comment to httpd \033[0m"
   sudo /bin/sed -i '/^#!\/bin/a\# chkconfig: 35 61 61\n# description: Apache' /etc/init.d/httpd
   echo ""
   echo ""

   echo -e "\033[33m Checking apache working or not"
   sudo /sbin/service httpd start
   netstat -tnlp | grep 80

   if [ $? -eq 0 ];then
      echo -e "\033[031m Apache server started \033[0m"
      echo -e "\033[033m Apche server installed successful!!! \033[0m"
   else 
      echo -e "\033[031m Apache does not working \033[0m"
      exit 222
   fi
else
   echo -e "\033[33m Cannot download files!!!Please use other mirrors or url avaliable!!!"
   echo -e "\033[31m Install Ended Unexpect\033[0m"
   exit 111
fi

阅读(1715) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~