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

相关推荐
远方 hi8 小时前
linux虚拟机连接不上Xshell
开发语言·php·apache
mqiqe2 天前
Apache Tika 详解
apache
鸠摩智首席音效师2 天前
如何解决 Apache Shutdown Unexpectedly 错误 ?
apache
大鳥2 天前
Apache Hive 聚合函数与 OVER 窗口函数:从基础到高级应用
hive·hadoop·apache
neter.asia3 天前
小程序获取微信运动步数
微信·小程序·apache
m0_548514773 天前
Centos7搭建PHP项目,环境(Apache+PHP7.4+Mysql5.7)
开发语言·php·apache
m0_748234524 天前
Apache Tomcat文件包含漏洞复现(详细教程)
java·tomcat·apache
代立冬4 天前
流行的开源高性能数据同步工具 - Apache SeaTunnel 整体架构运行原理
apache·datax·开源数据集成工具·超高性能数据集成工具·异构数据同步工具·比datax更好的工具
一條狗4 天前
20250120 深入了解 Apache Flink 的 Checkpointing
大数据·flink·apache
怎么昵称都被占用啊4 天前
【Linux系统环境中使用二进制包安装Apache】
linux·运维·apache