CentOS7.9下yum升级Apache HTTP Server2.4.6到2.4.60

1、CentOS7.9系统默认的Apache版本

在CentOS7.9上,如果使用yum安装Apache HTTP Server是最多到2.4.6版本的,这是因为el7下官方仓库的最高版本就是2.4.6,证据如下:

$ yum info httpd
......
Installed Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.6
Release     : 99.el7.centos.1
Size        : 9.4 M
Repo        : installed
From repo   : updates
Summary     : Apache HTTP Server
URL         : http://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.

2、借助第三方平台可否升级

根据这一篇,可以找到第三方的一个开源库:https://repo.codeit.guru/packages/centos/8/x86_64/,但是很可惜,这个开源库最低从el8开始,没有对el7提供支持,或者准确的说el7已经过时了,所以这个第三方平台升级行不通。

3、借助官方平台可否升级

找到CentOS官方镜像:http://mirror.centos.org/centos/7/os/x86_64/Packages/,但是很遗憾,依然404。官方也是最低从8开始,7已经过时了。
官方el7已过期

4、寻根索源找到Apache官方解决方案

对于没有现成rpm包提供的平台,可以通过rpmbuild编译生成。地址参考这里
官方解决方案不过编译过程,不会那么顺利,需要随时根据提示,安装对应的依赖,在这个过程中,又有个关键的点是,报错:找不到文件:httpd-2.4.60-1.x86_64/usr/lib64/httpd/modules/mod_mpm_event.so。这个时候,参考这篇文章,可以获得解决。这里列出几个关键点:

  1. 使用官方命令,编译rpm
rpmbuild -tb httpd-2.4.60.tar.bz2

期间运行报错找不到文件:httpd-2.4.60-1.x86_64/usr/lib64/httpd/modules/mod_mpm_event.so,是arp(Apache Portable Runtime)版本低,下载获取最新的1.7.4版本。

  1. 先完成支线任务编译apr,再继续编译apache。编译成功。
tar xvjf apr-1.7.4.tar.bz2
cp apr-1.7.4/apr.spec ../SPECS/
cd ../SPECS/
rpmbuild -ba apr.spec
=====编译apr完成====
cd ../RPMS/x86_64/
yum localinstall apr-1.7.4-1.x86_64.rpm apr-devel-1.7.4-1.x86_64.rpm
=====本地安装apr完成====
cd ../../SPECS/
rpmbuild -ba httpd.spec
=====编译httpd完成=====
cd ../RPMS/x86_64/
ll
total 11592
-rw-rw-r-- 1 fibre fibre  112588 Jul  2 15:40 apr-1.7.4-1.x86_64.rpm
-rw-rw-r-- 1 fibre fibre  479112 Jul  2 15:40 apr-debuginfo-1.7.4-1.x86_64.rpm
-rw-rw-r-- 1 fibre fibre  883796 Jul  2 15:40 apr-devel-1.7.4-1.x86_64.rpm
-rw-rw-r-- 1 fibre fibre 1442512 Jul  2 15:46 httpd-2.4.60-1.x86_64.rpm
-rw-rw-r-- 1 fibre fibre 3989440 Jul  2 15:46 httpd-debuginfo-2.4.60-1.x86_64.rpm
-rw-rw-r-- 1 fibre fibre  213624 Jul  2 15:46 httpd-devel-2.4.60-1.x86_64.rpm
-rw-rw-r-- 1 fibre fibre 4423920 Jul  2 15:46 httpd-manual-2.4.60-1.x86_64.rpm
-rw-rw-r-- 1 fibre fibre   81068 Jul  2 15:46 httpd-tools-2.4.60-1.x86_64.rpm
-rw-rw-r-- 1 fibre fibre   48384 Jul  2 15:46 mod_authnz_ldap-2.4.60-1.x86_64.rpm
-rw-rw-r-- 1 fibre fibre   48328 Jul  2 15:46 mod_lua-2.4.60-1.x86_64.rpm
-rw-rw-r-- 1 fibre fibre   25300 Jul  2 15:46 mod_proxy_html-2.4.60-1.x86_64.rpm
-rw-rw-r-- 1 fibre fibre   99136 Jul  2 15:46 mod_ssl-2.4.60-1.x86_64.rpm
  1. 升级Apache HTTP Server到最新版本
rpm -U httpd-2.4.60-1.x86_64.rpm --replacefiles
  1. 验证版本号
$ yum info httpd
......
Loaded plugins: changelog, fastestmirror, langpacks
Loading mirror speeds from cached hostfile
base                                                                                                                                                                                                                     | 2.9 kB  00:00:00     
Not using downloaded base/repomd.xml because it is older than what we have:
  Current   : Mon Mar 18 13:00:09 2024
  Downloaded: Mon Oct 17 08:02:38 2022
centos-sclo-rh                                                                                                                                                                                                           | 2.9 kB  00:00:00     
centos-sclo-sclo                                                                                                                                                                                                         | 2.9 kB  00:00:00     
elrepo                                                                                                                                                                                                                   | 2.9 kB  00:00:00     
epel                                                                                                                                                                                                                     | 2.9 kB  00:00:00     
extras                                                                                                                                                                                                                   | 2.9 kB  00:00:00     
Not using downloaded extras/repomd.xml because it is older than what we have:
  Current   : Fri Apr  5 17:49:29 2024
  Downloaded: Mon Oct 17 08:02:40 2022
remi                                                                                                                                                                                                                     | 2.9 kB  00:00:00     
updates                                                                                                                                                                                                                  | 2.9 kB  00:00:00     
Not using downloaded updates/repomd.xml because it is older than what we have:
  Current   : Sat Jun 22 00:30:50 2024
  Downloaded: Mon Oct 17 08:03:51 2022
Installed Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.60
Release     : 1
Size        : 4.4 M
Repo        : installed
Summary     : Apache HTTP Server
URL         : http://httpd.apache.org/
License     : Apache License, Version 2.0
Description : Apache is a powerful, full-featured, efficient, and freely-available
            : Web server. Apache is also the most popular Web server on the
            : Internet.
  1. 重启Apache HTTP Server
systemctl status httpd.service

相关推荐

  1. CentOS Linux Yum Docker安装与升级

    2024-07-10 04:32:05       26 阅读
  2. Centos Yum

    2024-07-10 04:32:05       37 阅读
  3. ubuntu 22.04 升级24.04

    2024-07-10 04:32:05       25 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-10 04:32:05       66 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-10 04:32:05       70 阅读
  3. 在Django里面运行非项目文件

    2024-07-10 04:32:05       57 阅读
  4. Python语言-面向对象

    2024-07-10 04:32:05       68 阅读

热门阅读

  1. MySQL快速安装(mysql8.0.30区别之前yum安装)

    2024-07-10 04:32:05       24 阅读
  2. FastGPT本地手动部署(一)mongodb和pgvector的安装

    2024-07-10 04:32:05       27 阅读
  3. 字符串

    2024-07-10 04:32:05       28 阅读
  4. 494. 目标和

    2024-07-10 04:32:05       26 阅读
  5. 微信小程序常用的事件

    2024-07-10 04:32:05       31 阅读
  6. Perl变量作用域全解析:掌握变量的可见之旅

    2024-07-10 04:32:05       28 阅读
  7. SRC漏洞挖掘技巧:修改返回包的各种姿势

    2024-07-10 04:32:05       19 阅读
  8. Linux: network: openvswitch: disk 访问速度导致不稳定

    2024-07-10 04:32:05       26 阅读