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

相关推荐

  • N22-第三周作业

    列出当前系统上所有已经登录的用户名,注意:同一个用户登录多次,则只显示一次即可。 [root@localhost ~]# w |cut -d ' ' -f1 |sort -u lucy root USER 2.取出最后登录到当前系统的用户的相关信息。 [root@localhost ~]# last -1 root   &nbs…

    Linux干货 2016-08-28
  • iptables 补充本

    浅谈iptables一 什么是iptablesiptables 是工作在内核之上的netfilter框架的前端工具(iptables是netfilter的管理工具这样说也不为过)Firewall:隔离工具,工作于主机或网络的边缘处,对经由的报文根据预先定义的规则(识别标准)进行检测,对于能够被规则匹配到的报文实行某种预定义的处理机制的一套组件; 硬…

    Linux干货 2017-05-15
  • 一张图认识开源世界

    开源精神:自由,创新,团结,互助,友爱,积极,进取。在开源环境下也产生了很多优秀的软件,让我们通过一幅图认识一下开源世界里的大咖们! 看图识物     墙上挂的牛头:伟大的开源计划GNU Wiki:http://zh.wikipedia.org/zh-cn/GNU     墙上日历上的信封标志:经典的linux下的邮件…

    Linux干货 2015-03-20
  • Linux之函数

      Linux之函数     函数介绍函数function是由若干条shell命令组成的语句块,实现代码重用和模块化编程。它与shell程序形式上是相似的,不同的是它不是一个单独的进程,不能独立运行,而是shell程序的一部分。函数和shell程序比较相似,区别在于:Shell程序在子Shell中运行而Shell函数在…

    Linux干货 2016-08-25
  • find和grep命令练习

                                    find和grep命令练习 1、显示当前系统上root,fedora,或user1用户的默认shell; ~]# cat /etc/pa…

    Linux干货 2016-10-23
  • Linux进程与计划任务

    Linux进程与计划任务 linux进程及作业管理 进程 内核的功用:进程管理、文件系统、网络功能、内存管理、驱动程序、安全功能等特权操作模式切换(理想状态):70%CPU时间用户模式+30%CPU时间内核模式进程(Process):是计算机中的程序关于某数据集合上的一次运行活动,是系统进行资源分配和调度的存在生命周期的基本单位,是操作系统结构的基础。在早期…

    Linux干货 2016-09-23