21-1.手动编译apache服务
作者:互联网
1.下载 Tarball https://httpd.apache.org/download.cgi 2.上传到服务器,并解压到 /usr/local/src drwxr-xr-x 12 1000 1000 4096 5月 18 05:21 httpd-2.4.48 3.cat README INSTALL $ ./configure --prefix=PREFIX #指定安装路径 $ make $ make install $ PREFIX/bin/apachectl start 4../configure --prefix=/usr/local/apache2 [root@gaocun httpd-2.4.48]# ./configure --prefix=/usr/local/apache2 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. 5.解决 configure: error: APR not found. Please read the documentation. 1.下载 APR http://apr.apache.org/download.cgi 2.解压到 /usr/local/src 3../configure --prefix=/usr/local/apr 4.make 5.make install 6.再次执行 ./configure --prefix=/usr/local/apache2 [root@gaocun httpd-2.4.48]# ./configure --prefix=/usr/local/apache2 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... yes setting CC to "gcc" setting CPP to "gcc -E" setting CFLAGS to " -g -O2 -pthread" setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE" setting LDFLAGS to " " configure: configure: Configuring Apache Portable Runtime Utility library... configure: checking for APR-util... no configure: error: APR-util not found. Please read the documentation. 7.解决 configure: error: APR-util not found. Please read the documentation. 1.下载 APR-util http://apr.apache.org/download.cgi 2.解压到 /usr/local/src [root@gaocun src]# tar -zxvf apr-util-1.6.1.tar.gz gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now 原因:这个Tarball没有经过zip压缩,所以不用使用-z来解压 3../configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config 4.make 编译时报错: xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录 #include <expat.h> ^ 编译中断。 make[1]: *** [xml/apr_xml.lo] 错误 1 原因:缺少<expat.h>包 解决:yum install expat-devel 5.make install 8.再次执行 ./configure --prefix=/usr/local/apache2 报错 configure: checking for APR-util... no configure: error: APR-util not found. Please read the documentation. 原因:手动指定 apr和apr-util的路径 ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre 报错: checking for pcre-config... false configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/ 原因:未找到pcre 1.下载 https://sourceforge.net/projects/pcre/ 2.解压到/usr/local/src 3.生成Makefile ./configure --prefix=/usr/local/pcre 报错:configure: error: Invalid C++ compiler or C++ compiler flags 原因:缺少gcc-c++ 库 解决: yum install -y gcc-c++ 4.make 5.make install 9.再次执行 ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre configure: summary of build options: Server Version: 2.4.48 Install prefix: /usr/local/apache2 C compiler: gcc -std=gnu99 CFLAGS: -g -O2 -pthread CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE LDFLAGS: LIBS: C preprocessor: gcc -E 10.make 11.make install 编译参考:https://blog.csdn.net/luckily01/article/details/25572769 配置参考:https://cloud.tencent.com/developer/article/1022738
标签:...,21,apr,checking,编译,usr,apache,local,configure 来源: https://www.cnblogs.com/bajiaotai/p/15089169.html