ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

21-1.手动编译apache服务

2021-08-02 11:32:39  阅读:218  来源: 互联网

标签:... 21 apr checking 编译 usr apache local configure


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

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有