Apache httpd 源碼安裝 提示APR錯誤linux
一、下載 HTTPD 源碼包apache
選擇 中國域名 cn 的站點:tcp
找到httpd:ide
二、回到Linux CentOS 中 ,使用wget名令下載httpd壓縮包:工具
[root@magedu ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.38.tar.gz --2019-07-21 13:16:50-- https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.38.tar.gz Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1 Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 9187294 (8.8M) [application/x-gzip]
三、解壓 下載文件;開發工具
[root@magedu ~]# tar zxvf httpd-2.4.38.tar.gz httpd-2.4.38/ httpd-2.4.38/config.layout httpd-2.4.38/configure.in httpd-2.4.38/Makefile.win httpd-2.4.38/configure httpd-2.4.38/test/ httpd-2.4.38/test/test_parser.c httpd-2.4.38/test/check_chunked httpd-2.4.38/test/make_sni.sh httpd-2.4.38/test/README httpd-2.4.38/test/test-writev.c httpd-2.4.38/test/test_limits.c httpd-2.4.38/test/tcpdumpscii.txt
四、在解壓以前,先安裝編譯器和開發工具包;測試
` [root@magedu ~]# yum install gcc "Developent Tools"`
五、進到解壓的httpd目錄,查看 configure 的幫助信息ui
[root@magedu ~]# cd httpd-2.4.38/ [root@magedu httpd-2.4.38]# ./configure --help
六、使用配置文件安裝code
[root@magedu httpd-2.4.38]# ./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd checking for chosen layout... Apache checking for working mkdir -p... yes checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu configure: configure: Configuring Apache Portable(移植) Runtime library(運行庫)... configure: checking for APR... no configure: error: APR not found. Please read the documentation.(錯誤:APR沒找到,請閱讀文檔)
提示報錯:
configure: error: APR not found. Please read the documentation.(錯誤:APR沒找到,請閱讀文檔)
提示沒有找到 APR,使用yum 來安裝,但安裝時必定要注意,提示要裝哪一個軟件,通常要在軟件的後面加上devel,也就是說要裝缺乏軟件的開發工具,好比這個提示apr,那就要裝 apr-devel:
#yum install apr-devel
安裝完成以後,再./configure;
特別注意,這個期間不能切換到其餘目錄中,整個安裝的過程必定要在這安裝軟件的根目錄中;
[root@magedu httpd-2.4.38]# ./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd checking for APR-util... no configure: error: APR-util not found. Please read the documentation.
提示缺乏apr-util,接着安裝apr-util的開發版,即 apr-util-devel
root@magedu httpd-2.4.39]# yum install apr-util-devel Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check --> Processing Dependency: libdb-devel(x86-64) for package: apr-util-devel-1.5.2-6.el7.x86_64 --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: apr-util-devel-1.5.2-6.el7.x86_64 --> Running transaction check ...
安裝完成以後,再./configure
[root@magedu httpd-2.4.38]# ./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd checking for pcre-config... false configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
提示pcre報錯,再安裝pcre,這個pcre也得裝開發版,即安裝pcre-devel:
[root@magedu httpd-2.4.39]# yum install pcre-devel -y
安裝完成以後,再./configure
# ./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd checking for chosen layout... Apache checking for working mkdir -p... yes checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu configure: ... config.status: creating include/ap_config_auto.h config.status: executing default commands configure: summary of build options: Server Version: 2.4.39 C compiler: gcc -std=gnu99 CFLAGS: -pthread CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE LDFLAGS: LIBS: C preprocessor: gcc -E
終於成功了,使用echo$?檢查是否成功:
[root@magedu httpd-2.4.39]# echo $? 0
而後使用make
[root@magedu httpd-2.4.39]# make Making all in srclib make[1]: Entering directory `/soft/httpd-2.4.39/srclib' make[1]: Leaving directory `/soft/httpd-2.4.39/srclib' Making all in os
最後:make install[root@magedu httpd-2.4.39]#make install
七、完成以後,配置PATH變量、man手冊,完成後,啓動服務,登錄地址,出現測試頁,則表示安裝成功;