基于 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目录下。

相关推荐
SeaTunnel2 天前
Apache SeaTunnel 2.3.10 正式发布 —— 全新功能与多项改进,助力数据集成再升级!
apache
路由侠内网穿透2 天前
本地部署开源流处理框架 Apache Flink 并实现外部访问
大数据·网络协议·tcp/ip·flink·服务发现·apache·consul
故事与他6453 天前
TBKDVR硬盘录像机device.rsp命令执行漏洞
服务器·网络·数据库·安全·网络安全·apache
DDDiccc5 天前
项目-苍穹外卖(十七) Apache POI+导出数据
apache
智慧源点5 天前
Apache Doris 高频问题排查指南:从报错到性能优化
apache
摇滚侠6 天前
org.apache.maven.surefire:surefire-junit-platform:jar:2.22.2 Maven打包失败
junit·maven·apache
爱穿衬衫的张某某6 天前
httpClient_apache过滤ssl证书校验
网络协议·apache·ssl
SeaTunnel6 天前
Apache SeaTunnel同步MySQL到Doris的优化策略
数据库·mysql·postgresql·apache
昨天今天明天好多天7 天前
【Apache Hive】
hive·hadoop·apache
天下无敌笨笨熊8 天前
apache连接池机制讨论
开发语言·python·apache