編譯安裝Apache 2.4

好幾年沒有編譯安裝Apahce,今天一試,發現還真不是一件容易事兒。幾經測試,發現咱們在安裝前須要如下幾樣東西:c++

1)gccapache

2)gcc-c++bash

3)APR測試

4)APR-Utils阿里雲

5)PCREcode

6)YUMget

操做步驟以下:編譯器

第1步:it

# yum -y groupinstall "Developement Tools"

//這個把gcc及後面安裝PCRE-8.38須要的編譯器所有都安裝上

第2步:下載Apache、APR、APR-Utils、PCRE編譯

# wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.35.tar.gz
# wget http://mirrors.hust.edu.cn/apache//apr/apr-1.6.5.tar.gz
# wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz

能夠看到,下載的pcre的版本比較低。是由於pcre2,沒法經過。

第3步:安裝APR

# tar xvf apr-1.6.5.tar.gz
# cd apr-1.6.5
# ./configure
# make && make install
# cd ..

第4步:安裝APR-Utils,這一步裏,要先安裝expat-devel,不然會出錯。並且,163.com的yum源裏沒有這個軟件包,只能用阿里雲的yum源。更改yum源,請見我前面一篇文章。

# yum -y install expat-devel
# tar xvf apr-util-1.6.1.tar.gz
# cd  apr-util-1.6.1
# ./configure --with-apr=/usr/local/apr
# cd ..

第5步:安裝PCRE

# tar xvf pcre-8.38.tar.gz
# cd pcre-8.38
# ./configure --prefix=/usr/local/pcre
# cd ..

第6步:安裝Apache

# tar xvf httpd-2.4.35.tar.gz
# cd httpd-2.4.35
# ./configure --enable-so --with-pcre=/usr/local/bin/pcre-config
# make
# make install
# /usr/local/apache2/bin/apachectl start

這個時候,若是順利的話,就會安裝成功,能夠使用/usr/local/apache2/bin/apachectl start來啓動Apache。這個不能加入systemctl的服務中去,還要作一番工做。

相關文章
相關標籤/搜索