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


    编译环境:

    操作系统:CentOS7

    httpd版本:2.4.58

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

    下载httpd源码:

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

    制作RPM包

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

    rpmbuild -tb httpd-2.4.58.tar.bz2

    可能会报如下错误:

    1. error: Failed build dependencies:
    2. autoconf is needed by httpd-2.4.58-1.x86_64
    3. libuuid-devel is needed by httpd-2.4.58-1.x86_64
    4. apr-devel >= 1.4.0 is needed by httpd-2.4.58-1.x86_64
    5. apr-util-devel >= 1.4.0 is needed by httpd-2.4.58-1.x86_64
    6. openldap-devel is needed by httpd-2.4.58-1.x86_64
    7. lua-devel is needed by httpd-2.4.58-1.x86_64
    8. libxml2-devel is needed by httpd-2.4.58-1.x86_64
    9. openssl-devel is needed by httpd-2.4.58-1.x86_64

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

    yum install -y autoconf libuuid-devel apr-devel apr-util-devel openldap-devel lua-devel libxml2-devel openssl-devel 

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

    rpmbuild -tb httpd-2.4.58.tar.bz2

    可能会报如下错误:

    1. RPM build errors:
    2. File not found: /root/rpmbuild/BUILDROOT/httpd-2.4.58-1.x86_64/usr/lib64/httpd/modules/mod_mpm_event.so

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

    1. [root@~ rpmbuild]# rpm -qa|grep apr
    2. apr-util-1.5.2-6.el7.x86_64
    3. apr-devel-1.4.8-7.el7.x86_64
    4. apr-util-devel-1.5.2-6.el7.x86_64
    5. apr-1.4.8-7.el7.x86_64

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

    rpmbuild -tb apr-1.7.4.tar.bz2

    可能出现如下错误:

    1. error: Failed build dependencies:
    2. libtool is needed by apr-1.7.4-1.x86_64
    3. doxygen is needed by apr-1.7.4-1.x86_64

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

    [root@~ rpmbuild]# yum install -y libtool doxygen

    重新执行APR的打包命令:

    rpmbuild -tb apr-1.7.4.tar.bz2

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

    rpmbuild -tb apr-util-1.6.3.tar.bz2

    可能出现如下错误:

    1. error: Failed build dependencies:
    2. db4-devel is needed by apr-util-1.6.3-1.x86_64
    3. postgresql-devel is needed by apr-util-1.6.3-1.x86_64
    4. mysql-devel is needed by apr-util-1.6.3-1.x86_64
    5. sqlite-devel >= 3.0.0 is needed by apr-util-1.6.3-1.x86_64
    6. unixODBC-devel is needed by apr-util-1.6.3-1.x86_64
    7. nss-devel is needed by apr-util-1.6.3-1.x86_64

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

    yum install -y db4-devel  postgresql-devel mysql-devel  sqlite-devel  unixODBC-devel nss-devel

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

    rpmbuild -tb apr-util-1.6.3.tar.bz2

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

    1. 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
    2. 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的命令:

    rpmbuild -tb httpd-2.4.58.tar.bz2

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

  • 相关阅读:
    我在玛莎拉蒂的广告上,加了9个特效后,科技感拉满!
    NPS:使用 Windows NPS Server 部署 802.1X 无线认证(4)
    Python生成器
    蓝桥杯训练题JAVA实现 入门训练 圆的面积
    JS基础知识
    阿里资深专家撰写出的Nginx底层与源码分析手册,GitHub已爆赞
    阿里云ECS手动挂载磁盘
    FFplay文档解读-13-设备选项,输入设备一
    odoo 编码规范(编程规范、编码指南)
    【Spring框架】Spring概述及基本应用
  • 原文地址:https://blog.csdn.net/lhjlhj123123/article/details/137279922