Apache one-click installation script and apache one-click script
To install apace in apache recently, you must configure apr, apr-util, and pcre. The so-called programmer's spirit is to reduce repetitive work. Please refer to the apache installation script I wrote below:
I also put this script on my github.
#! /Bin/bash # sudo is required to execute dir = 'pwd' # To install pcre, install g ++ if [['ls/etc | grep redhat-release' first '! = ""] Then yum-y install gcc-c ++ elif [['ls/etc | grep debian_version '! = ""] Then apt-get-y install gcc-c ++ fiif [['ls | grep apr' = ""] then wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.2.tar.gzfitar-zxvf apr-1.5.2.tar.gzmkdir/ usr/local/lib/apr-1.5.2cd $ dir/apr-1.5.2. /configure -- prefix =/usr/local/lib/apr-1.5.2 makemake installcd $ dirif [['ls | grep apr-util '= ""] then wget http://mirrors.cnnic.cn/apache//apr/apr-util-1.5.4.tar.gzfitar-zxvf apr-util-1. 5.4.tar.gzmkdir/usr/local/lib/apr-util-1.5.4.tar.gzcd $ dir/apr-util-1.5.4. /configure -- prefix =/usr/local/lib/apr-util-1.5.4 -- with-apr =/usr/local/lib/apr-1.5.2make make installcd $ dirif [['ls | grep pcre' = ""] then wget http://ncu.dl.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gzfitar-zxvf pcre-8.37.tar.gzmkdir/usr/local/lib/pcre-8.37cd $ dir/pcre-8.37. /configure -- prefix =/usr/local/l Ib/pcre-8.37make make installcd $ dirif [['ls | grep httpd '= ""] then wget http://www.apache.org/dist/httpd/httpd-2.4.12.tar.gzfitar-zxvf httpd-2.4.12.tar.gzmkdir/usr/local/lib/httpd-2.4.12cd $ dir/httpd-2.4.12. /configure -- prefix =/usr/local/lib/httpd-2.4.12 -- with-apr =/usr/local/lib/apr-1.5.2 -- with-apr-util =/usr/local/lib/ apr-util-1.5.4 -- with-pcre =/usr/local/lib/pcre-8.37 -- enable-somakemake Install # solve httpd: cocould not reliably determine the server's fully qualified domain name, using 127.0.1.1. set the 'servername' directive globally to suppress this messagesed-I's/^ # ServerName www.example.com: 80/ServerName localhost/G'/usr/local/lib/httpd-2.4.12/conf/httpd. conf/usr/local/lib/httpd-2.4.12/bin/apachectl start # start apacheif [['curl-s localhost: 80 | grep "It works "'! = ""] Then echo "------------------------ successful installation -----------------------------------" cd $ dir rm-rf apr-1.5.2/apr-util-1.5.4/pcre-8.37/httpd-2.4.12/fi