centos7編譯安裝Apache


一、安裝

  安裝之前先將服務器的防火牆關掉。

  systemctl  stop  firewalld

  systemctl  disable  firewall

第一步:

  安裝apr

    下載:

    wget -c http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.3.tar.bz2 

    解壓該文件:

    tar -jvxf apr-1.6.3.tar.bz2
    檢測:

    cd apr-1.6.3
    ./configure --prefix=/usr/local/apr/
    編譯:

    make
    make install

第二步:

  安裝apr-util

    下載:

    wget -c http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.bz2

    解壓該文件:
    tar -jvxf apr-util-1.6.1.tar.bz2

    檢測:
    cd apr-util-1.6.3
    ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/

    編譯:
    make
    make install

第三步:

  安裝pcre

    下載:

    wget -c http://ftp.pcre.org/pub/pcre/pcre-8.42.tar.bz2

    解壓該文件:
    tar -jvxf pcre-8.42.tar.bz2

    檢測:
    cd pcre-8.42
    ./configure --prefix=/usr/local/pcre/

    編譯:
    make
    make install

第四步:
  安裝httpd

    下載:

    wget -c http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.bz2

    解壓該文件:
    tar -jvxf httpd-2.4.29.tar.bz2

    檢測:
    cd httpd-2.4.29
    ./configure --prefix=/usr/local/httpd/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/

    編譯:
    make
    make install

第五步:

  配置/usr/local/apache2/conf/httpd.conf

      ServerName www.examda.com:80
      改為
      ServerName localhost:80

第六步:

  啟動apache服務

    /usr/local/apache2/bin/apachectl start


 

二、檢測

  使用瀏覽器訪問本地IP

  出現It works!成功


 

三、報錯處理

  (1)configure: error: APR not found. Please read the documentation.

    這是沒有安裝apr或者apr安裝失敗導致的,重新安裝apr。

      安裝請查看第一步。

  (2)configure: error: APR-util not found. Please read the documentation.

    這是沒有安裝apr-util或者apr-util安裝失敗導致的,重新安裝apr-util。

      安裝請查看第二步。

  (3)configure: error: no acceptable C compiler found in $PATH

    這是沒有安裝gcc編譯器或者gcc編譯器安裝失敗導致的,重新安裝gcc。

      yum  install  -y  gcc

  (4)xml/apr_xml.c:35:19: 致命錯誤:expat.h:沒有那個文件或目錄

    這是沒有安裝expat-devel或者expat-devel安裝失敗導致的,重新安裝expat-devel。

      yum  install  -y  expat-devel

  (5)configure: error: Invalid C++ compiler or C++ compiler flags

    這是沒有安裝gcc-c++或者gcc-c++安裝失敗導致的,重新安裝gcc-c++

      yum  install  -y  gcc-c++

  (6)configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

    這是沒有安裝pcre或者pcre安裝失敗導致的,重新安裝pcre。

      安裝請查看第三步。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM