美文网首页
Apache升级

Apache升级

作者: Habit_1027 | 来源:发表于2023-05-23 14:41 被阅读0次

一、前提

  • 备份旧版httpd的配置,卸载旧版的httpd。

  • 时间:2023-5-24 系统:Centos 7.6 默认版本:Apache 2.4.6

[root@habits ~]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Apr  5 2023 17:18:30
  • 这时候最新的apache版本是2.4.57
4c3a9fc07f1dc2993c8a9262b5c08b2.png

二、更新版本

  • 查找Centos上软件库里的httpd版本:
[root@habits ~]# yum info httpd
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * centos-sclo-sclo: mirrors.bupt.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Installed Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.6
Release     : 98.el7.centos.7
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.4.6版本的apache)

  • CodeIT库提供了最新版本的服务器软件(Apache & Nginx)。这个库依赖 epel 。
    先要安装 epel-release
[root@habits ~]# yum install -y epel-release
  • 安装CodeIT库
[root@habits ~]# cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el7.repo `rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo

# /etc/yum.repos.d目录下新增了文件: codeit.el7.repo 内容如下:
[CodeIT]
name=CodeIT repo
baseurl=https://repo.codeit.guru/packages/centos/7/$basearch
enabled=1
gpgkey=https://repo.codeit.guru/RPM-GPG-KEY-codeit
gpgcheck=1
  • 再次查询可以安装的版本
[root@habits ~]# yum info httpd
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * centos-sclo-sclo: mirrors.bupt.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Installed Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.6
Release     : 98.el7.centos.7
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.

Available Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.57
Release     : 1.codeit.el7
Size        : 1.4 M
Repo        : CodeIT/x86_64
Summary     : Apache HTTP Server
URL         : https://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.

(显示有2.4.57版本)

  • 安装新的httpd
[root@habits ~]# yum -y install httpd
[root@habits ~]# systemctl start httpd && systemctl enable httpd
[root@habits ~]# httpd -v

三、排错

  • 安装后不能运行(提示缺少libpcre2-8.so.0)
find / -name libpcre2-8.so.0                  # 找到文件的位置,我的系统中有这个文件,只是不能识别
cp   libpcre2-8.so.0  /usr/lib64/     # 复制到/usr/lib64/这个目录
systemctl restart httpd                       # 再次运行可以启动了

相关文章

网友评论

      本文标题:Apache升级

      本文链接:https://www.haomeiwen.com/subject/kyrxedtx.html