先给出自动化编译安装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
下一篇 2016-10-30

相关推荐

  • LVS的详细应用

    LVS是Linux Virtual Server的简写, 意思是Linux虚拟服务器, 是一个虚拟的服务器集群系统. LVS的宗旨:    1. 使用集群技术和Linux操作系统实现一个高性能, 高可用的服务器;    2. 很好的可伸缩性(Scalability);    3. 很好的可靠性(Re…

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

    1、建立samba共享,共享目录为/data,要求:(描述完整的过程)   1)共享名为shared,工作组为magedu;   2)添加组develop,添加用户gentoo,centos和ubuntu,其中gentoo和centos以develop为附加组,ubuntu不属于develop组;密码均为用户名;   3)添加s…

    Linux干货 2016-08-24
  • read,locate ,find 的总结及相关联系

    read 变量名 read 变量名1 [变量名2] < 文件名不支持管道read 变量名1 [变量名2] <<< “值1 [值2] …”使用read来把输入值分配给一个或者多个shell变量     -p 指定要显示的提示     # read -p…

    Linux干货 2017-08-12
  • N25-第二周作业

    1、linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示 linux上处理目录的常用命令:     ls :列出目录     cd :切换目录     pwd:显示当前工作路径    &nbs…

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

    1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。     [root@director2 ~]# cp -a /etc/skel /home/tuser1   &n…

    Linux干货 2016-08-29
  • linux文件管理

    目录创建删除,软硬链接的区别和注意,file命令的使用,工作中遇到一些情况的处理方法

    2017-11-18