先给出自动化编译安装httpd的脚本,后面的mysql,php-fpm,xcache等还在测试中

自动化编译安装httpd的脚本!
FUNDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "Make sure  you are ready for installing apache!"
read -p "Please input the dir wher you want to download these packages!"  pkg
declare -a  numberlists
echo "Current dirpath is  $FUNCDIR"
( cd  $pkg  &&
 echo "apr-1.5.2.tar.bz2 is downloading please be patient!"
 wget http://mirrors.aliyun.com/apache/apr/apr-1.5.2.tar.bz2 &>/dev/null  && echo "apr-1.5.2.tar.bz2 has downloaded  successfully!"
 echo "apr-util-1.5.4.tar.bz2 is downloading please be patient!"
        tar xf  $pkg/`ls $pkg |grep "httpd"`   -C  /usr/local
        fi

        # "/usr/local/`ls /usr/local |grep apr-1`"
        #aprutildir= "/usr/local/`ls /usr/local |grep "apr-util"`"
        #httpddir= "/usr/local/`ls /usr/local |grep httpd `"
                (cd /usr/local/`ls /usr/local  | grep apr-[0-9].[0-9].[0-9]`
                if      [   -z   `ls /usr/local  | grep "apr$"`   ] ;then
                ./configure  --prefix=/usr/local/apr  | tee  /tmp/apr.out
                make
                make install
                else  echo "apr has installed early!"
                fi )

                (cd /usr/local/`ls /usr/local |grep "apr-util"`
                [  -z  "`ls /usr/local  | grep "apr-util$"`"  ]  &&
                (./configure --prefix=/usr/local/apr-util  --with-apr=/usr/local/apr |tee /tmp/apr-util.out &&  make && make install
                echo "Apr-util is installed sucessfully!") || echo "apr-util has installed early!")

                (cd /usr/local/`ls /usr/local | grep "httpd"`
                [  -z               `ls /usr/local | grep "apache" `    ]               && ( ./configure  --prefix=/usr/local/apache                                     --sysconfdir=/etc/httpd         --enable-so --enable-rewrite --enable-ssl --enable-cgi                                                                --enable-cgid --enable-modules=most --enable-mods-shared=most                                  --enable-mpms-shared=all                               --with-mpm=event --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util |tee  /tmp/httpd.out   &&  make && make install                          echo "Httpd is installed successfully!")   || echo "httpd has installed early" )
                ( cd     $FUNDIR                     &&  sed -n "p" httpd_conf_default |tee   /etc/httpd/httpd.conf >/dev/null               &&                             sed -n "p"  httpd_server_default |tee /etc/init.d/httpd24 >/dev/null && chkconfig --add httpd24  && chkconfig httpd24 on )
                (rm -rf /etc/httpd/conf.d/httpd.conf > /dev/null && echo "export PATH=$PATH:/usr/local/`ls /usr/local |                                               grep httpd`" > /etc/profile.d/apache.sh && chmod +x /etc/init.d/httpd24         && echo "/usr/local/apache/lib"                                        > /etc/ld.so.conf.d/apache.conf  && ldconfig  &&
                echo "Configuration is ok!"                         && [ -z "/usr/include/apache" ] && ln -s /usr/local/apache/include/                                /usr/include/apache     )
                (  echo "export PATH=$PATH:/usr/local/apache/bin" > /etc/profile.d/httpd.sh
                   echo  "It works!! "  )
        ;;       
        ${numberlists[1]})
        break
        esac
done

原创文章,作者:sjfbjs,如若转载,请注明出处:http://www.178linux.com/50533

(0)
sjfbjssjfbjs
上一篇 2016-10-30 21:02
下一篇 2016-10-30 21:02

相关推荐

  • 第五周小练习

    1显示当前系统上root,fedora或user1用户的默认shell egrep "^(root|user1|fedora)" /etc/passwd|cut -d ':' -f 1,7 2找出/etc/rc.d/init.d/functions文件中某个单…

    Linux干货 2016-12-12
  • 马哥教育网络班22期+第二周课程练习

    一、Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示? cp命令:copy,有2类复制方法  1、单源复制:如果DEST不存在:则实现创建此文件,并复制源文件的数据流至DEST中;     如果DEST存在:如果DEST是非目录文件,则覆盖目标文件;如果DEST是目录文件,则先DEST目录下创建一个与源文件…

    Linux干货 2016-08-22
  • N21第五周

    1.显示/boot/grub2/grub.cfg中以至少一个空白字符开头的行; ]# grep '^[[:space:]]\+' /boot/grub2/grub.cfg 2.显示/etc/rc.d/init.d/functions文件中以#开头,后面跟至少一个空白字符,而后又有至少一个非空白字符的行; ]#…

    Linux干货 2016-08-15
  • 从需求和安全角度开始linux(一)-20151211

    突然想从需求和安全的角度来展开各种命令。因为我觉得linux中所有的常用命令基本都是需求和安全的产物。 当我打开一个CLI(command line interface)界面的linux操作系统时: 一、我希望能够看到里面有什么,因此有了ls的命令。      ls – list&nbs…

    Linux干货 2015-12-15
  • 20160808作业

    1、删除/etc/grub2.conf文件中所有以空白开头的行行首的空白字符      2、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符      3、在/root/install.log每一行行首增加#号  &nbs…

    Linux干货 2016-08-11
  • 安装MariaDB

    1、安装MariaDB 安装命令 yum -y install mariadb mariadb-server安装完成MariaDB,首先启动MariaDB systemctl start mariadb设置开机启动 systemctl enable mariadb接下来进行MariaDB的相关简单配置 mysql_secure_installation首先是…

    Linux干货 2017-08-08