源碼編譯安裝apache詳解(2014-11-13)

來源:互聯網
上載者:User

標籤:apache   源碼安裝   httpd   apr   pcre   apr-util   

一、下載Apache 2.4及依賴包

    Apache官網下載:http://apache.fayea.com/apache-mirror/httpd/

    由於Apache依賴於APR、APR-Util和PCRE,所以需要下載:

    APR + APR-Util:http://mirror.bjtu.edu.cn/apache//apr/

    PCRE:http://sourceforge.net/projects/pcre/files/pcre/

在此,筆者使用均為目前最新版本,Apache 2.4.10,APR 1.5.1 ,APR-Util 1.5.4,PCRE 8.36

(注意:apache2.4 要求apr版本高於1.4.0)

二、安裝依賴    2.1 APR及APR-Util安裝

    解壓縮APR及APR-Util

    [[email protected] opt]# tar zxvf apr-1.5.1.tar.gz -C /opt    [[email protected] opt]# tar zxvf apr-util-1.5.1.tar.gz -C /opt

    安裝APR及APR-Util

    [[email protected] opt]# cd /opt/apr-1.5.1      [[email protected] apr-1.5.1]#./configure --prefix=/usr/local/apr      [[email protected] apr-1.5.1]# make && make install
    [[email protected] opt]# /opt/apr-util-1.5.4      [[email protected] apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr    [[email protected] apr-util-1.5.4]# make && make install
    2.2 安裝PCRE

    首先請確定系統安裝了Perl,Perl在此不再贅述,如有需要請去官網查看安裝細則:http://www.cpan.org/src/README.html

    解壓縮PCRE

    [[email protected] ~]# tar zxvf pcre-8.36.tar.gz -C /opt

    安裝PCRE

    [[email protected] ~]# cd /opt/pcre-8.36    [[email protected] pcre-8.36]# ./configure --prefix=/usr/local/pcre    [[email protected] pcre-8.36]# make && make install
三、安裝Apache 2.4

    解壓縮Apache 2.4

    [[email protected] ~]# tar zxvf httpd-2.4.10.tar.gz -C /opt

    安裝Apache

    [[email protected] ~]# cd /opt/httpd-2.4.10    [[email protected] httpd-2.4.10]#  ./configure --prefix=/usr/local/apache --enable-mods-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre    [[email protected] httpd-2.4.10]# make && make install
四、啟動Apache

    通過apachectl啟動Apach

    [[email protected] ~]# /usr/local/apache/bin/apachectl start

    檢查是否有Apache進程

    [[email protected] ~]# ps aux | grep httpd

    如果有Apache的進程,則證明啟動成功,瀏覽器地址欄輸入 http://localhost 試試吧~

    啟動成功之後,可以將apachectl拷貝到/etc/init.d下,作為service啟動。

    [[email protected] ~]# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd    [[email protected] ~]# service httpd start
擴充閱讀
  • Apache官方安裝文檔:http://httpd.apache.org/docs/2.4/install.html


源碼編譯安裝apache詳解(2014-11-13)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.