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

相关推荐

  • 获取linux命令帮助的方法

    1.help command 适用于内建命令。 2.command -hlep 适用于外部命令。 3.info command 适用于外部命令。 4.man command 适用外部命令和内建命令。     man帮助命令分章节             centos7:man 1…

    Linux干货 2017-08-19
  • 浅谈用户和组相关配置文件

    用户、组和权限的管理 Linux如何像Windows系统那样,可以不输入密码直接进入图形界面?那么如何如何自动登录图形界面呢?这就要用到编辑配置文件: nano  /etc/gdm/custom.cof  ,在里面加上   automaticLoginEnable=true automaticLogin=root 退出…

    Linux干货 2016-10-23
  • linux基础1

    linux基础

    Linux干货 2018-03-08
  • awk大法

    awk awk概念 一款用于数据流的文本处理工具,它将文件作为记录序列处理。在一般情况下,文件内容的每行都是一个记录。每行内容都会被分割成一系列的域,因此,我们可以认为一行的第一个词为第一个域,第二个词为第二个,以此类推。AWK程序是由一些处理特定模式的语句块构成的。AWK一次可以读取一个输入行。对每个输入行,AWK解释器会判断它是否符合程序中出现的各个模式…

    Linux干货 2016-12-04
  • 集群基本介绍

    Linux Cluster: Cluster:计算机集合,为解决某个特定问题组合起来形成的单个系统; Linux Cluster类型: LB:Load Balancing,负载均衡;主机来平均访问的压力。由负载均衡器和多个后端主机分担主。 HA:High Availiablity,高可用,靠冗余节点实现;提高服务的可用性,有多个负载均衡器(和备份)来接收来自…

    Linux干货 2016-10-30
  • 常用大数据词汇中英文对照表

    A 聚合(Aggregation) – 搜索、合并、显示数据的过程 算法(Algorithms) – 可以完成某种数据分析的数学公式 分析法(Analytics) – 用于发现数据的内在涵义 异 常检测(Anomaly detection) – 在数据集中搜索与预期模式或行为不匹配的数据项。除了“Anomalies”,用来表示异常的词有以下几种:outlie…

    Linux干货 2015-03-10