基于 CentOS7 制作 Apache HTTPD 2.4.58 的RPM安装包

编译环境:

操作系统:CentOS7

httpd版本:2.4.58

制作工具:rpmbuild(这个之前的文章有介绍,看这里

下载httpd源码:

官网目前的最新版本是2.4.58,下载备用,并放入准备好的编译机器上。

制作RPM包

找到安装包的位置,然后使用如下命令,即可开始制作RPM包:

bash 复制代码
rpmbuild -tb httpd-2.4.58.tar.bz2

可能会报如下错误:

bash 复制代码
error: Failed build dependencies:
        autoconf is needed by httpd-2.4.58-1.x86_64
        libuuid-devel is needed by httpd-2.4.58-1.x86_64
        apr-devel >= 1.4.0 is needed by httpd-2.4.58-1.x86_64
        apr-util-devel >= 1.4.0 is needed by httpd-2.4.58-1.x86_64
        openldap-devel is needed by httpd-2.4.58-1.x86_64
        lua-devel is needed by httpd-2.4.58-1.x86_64
        libxml2-devel is needed by httpd-2.4.58-1.x86_64
        openssl-devel is needed by httpd-2.4.58-1.x86_64

错误信息提示需要安装如上几个devel包,那就先安装:

bash 复制代码
yum install -y autoconf libuuid-devel apr-devel apr-util-devel openldap-devel lua-devel libxml2-devel openssl-devel 

安装成功之后,重新执行打包命令:

bash 复制代码
rpmbuild -tb httpd-2.4.58.tar.bz2

可能会报如下错误:

bash 复制代码
RPM build errors:
    File not found: /root/rpmbuild/BUILDROOT/httpd-2.4.58-1.x86_64/usr/lib64/httpd/modules/mod_mpm_event.so

出现这个错误,是由于系统中的APR版本较低,查看APR版本,显示如下:

bash 复制代码
[root@~ rpmbuild]# rpm -qa|grep apr
apr-util-1.5.2-6.el7.x86_64
apr-devel-1.4.8-7.el7.x86_64
apr-util-devel-1.5.2-6.el7.x86_64
apr-1.4.8-7.el7.x86_64

因此,我们需要升级APR。由于没有现成的APR高版本,所以,需要先制作APR的安装包,制作方法是一样的,先下载APRAPR-util的源码包,然后执行打包命令:

bash 复制代码
rpmbuild -tb apr-1.7.4.tar.bz2

可能出现如下错误:

bash 复制代码
error: Failed build dependencies:
        libtool is needed by apr-1.7.4-1.x86_64
        doxygen is needed by apr-1.7.4-1.x86_64

同前面一样,缺少依赖包,安装libtool和doxygen:

bash 复制代码
[root@~ rpmbuild]# yum install -y libtool doxygen

重新执行APR的打包命令:

bash 复制代码
rpmbuild -tb apr-1.7.4.tar.bz2

之后,执行APR-util的打包命令:

bash 复制代码
rpmbuild -tb apr-util-1.6.3.tar.bz2

可能出现如下错误:

bash 复制代码
error: Failed build dependencies:
        db4-devel is needed by apr-util-1.6.3-1.x86_64
        postgresql-devel is needed by apr-util-1.6.3-1.x86_64
        mysql-devel is needed by apr-util-1.6.3-1.x86_64
        sqlite-devel >= 3.0.0 is needed by apr-util-1.6.3-1.x86_64
        unixODBC-devel is needed by apr-util-1.6.3-1.x86_64
        nss-devel is needed by apr-util-1.6.3-1.x86_64

同前面一样,缺少依赖包,执行以下命令,安装依赖包:

bash 复制代码
yum install -y db4-devel  postgresql-devel mysql-devel  sqlite-devel  unixODBC-devel nss-devel

接着,重新执行APR-util的打包命令:

bash 复制代码
rpmbuild -tb apr-util-1.6.3.tar.bz2

至此,APR和APR-util的rpm包制作好了,以下命令是进行升级操作:

bash 复制代码
rpm -U /root/rpmbuild/RPMS/x86_64/apr-1.7.4-1.x86_64.rpm /root/rpmbuild/RPMS/x86_64/apr-devel-1.7.4-1.x86_64.rpm

rpm -U /root/rpmbuild/RPMS/x86_64/apr-util-1.6.3-1.x86_64.rpm /root/rpmbuild/RPMS/x86_64/apr-util-devel-1.6.3-1.x86_64.rpm

升级成功之后,重新执行打包HTTPD的命令:

bash 复制代码
rpmbuild -tb httpd-2.4.58.tar.bz2

不出意外的话,httpd及其相关的rpm都将打包成功。默认情况下,安装包在/root/rpmbuild/RPMS/x86_64目录下。

相关推荐
s甜甜的学习之旅6 小时前
Apache POI练习代码
apache
是小崔啊6 小时前
开源轮子 - Apache Common
java·开源·apache
程序猿阿伟11 小时前
《探索 Apache Spark MLlib 与 Java 结合的卓越之道》
java·spark-ml·apache
开心工作室_kaic1 天前
springboot461学生成绩分析和弱项辅助系统设计(论文+源码)_kaic
开发语言·数据库·vue.js·php·apache
cr.sheeper1 天前
Vulnhub靶场Apache解析漏洞
网络安全·apache
ccc_9wy2 天前
Apache Solr RCE(CVE-2017-12629)--vulhub
apache·solr·lucene·burp suite·vulhub·远程命令执行漏洞rce·cve-2017-12629
ccc_9wy2 天前
Apache Solr RCE(CVE-2019-0193)--vulhub
网络安全·apache·solr·lucene·vulhub·cve-2019-0193·远程命令执行漏洞rce
casual_clover2 天前
搭建一个简单的Web服务器(Apache2.4)
服务器·apache
李三醒2 天前
Apache Tomcat 漏洞CVE-2024-50379条件竞争文件上传漏洞 servlet readonly spring boot 修复方式
spring boot·tomcat·apache
鸠摩智首席音效师2 天前
Apache 如何监听多个端口 ?
apache