先给出自动化编译安装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

相关推荐

  • LAMP基于编译安装方式实现(httpd与php以fastcgi方式结合)3

    概述     在某些现有rpm包不能满足需求的时候,可能需要编译安装LAMP环境,本篇就介绍下php与httpd结合方式为fastcgi方式结合时的编译安装,同时,由于httpd与php以module方式结合时,仅是编译选项有所差别,故也会简单说明下编译选项的差异 环境     CentOS7系统,…

    Linux干货 2016-10-17
  • N22-第七周作业

    1、创建一个10G分区,并格式为ext4文件系统;    (1) 要求其block大小为2048, 预留空间百分比为2, 卷标为MYDATA, 默认挂载属性包含acl;    (2) 挂载至/data/mydata目录,要求挂载时禁止程序自动运行,且不更新文件的访问时间戳; [root@localhost ~]# fd…

    Linux干货 2016-10-07
  • 19 vim编辑器

    19 vim编辑器 一、杂项知识整理 1、vi +6 FILE:打开并且光标在第六行。     vi +/pattern 打开文件后,光标处于第一个被pattern匹配到的行的行首     vim + FILE 直接打开file,光标在最后一行   &nbsp…

    Linux干货 2016-08-10
  • ansible部分功能详解

    一. 架构: 组成     ansible core:     modules:     Core Module     Custom Module   Host Inventory: 主机清单       File   &nbs…

    Linux干货 2016-11-11
  • 网络分层模型(OSI,TCP/IP)

    目前存在的两种网络分层模型:OSI模型和TCP/IP模型。 OSI模型一共分为七层 TCP/IP模型和OSI模型类似,但是只分为四层。 OSI模型 OSI的全程是Open Systems Interconncection,即开放系统互联,它由ISO(International Organization for Standardization)制定。 OSI是…

    2017-11-27
  • 【26期】Linux第七周学习小总结

        今天给大家的分享是本周的一个有趣的小内容,LVM逻辑卷相关的,为什么分享这个内容呢?主要是刚没有接触或者说深入接触Linux时,有人在群里提问,如果不用虚拟机,那Centos本身有快照吗?当时说的答案很热闹,不过大部分还是倾向于没有快照,本周学习的逻辑卷管理器章节里,就这个问题给了一个准确答案,那我们一起来看一下吧!  …

    2017-08-26