Centos7下httpd最新版本安装或者更新至最新版本

时间:2025-03-08 09:57:29

查找Centos上软件库里的httpd版本:
yum info httpd

yum info httpd
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * epel: 
 * remi-php72: 
 * remi-safe: 
已安装的软件包
名称    :httpd
架构    :x86_64
版本    :2.4.6
发布    :97..2
大小    :9.4 M
源    :installed
来自源:updates
简介    : Apache HTTP Server
网址    :/
协议    : ASL 2.0
描述    : The Apache HTTP Server is a powerful, efficient, and extensible
         : web server.

默认软件库中只有2.4.6版本的apache。

CodeIT这个库提供了最新版本的服务器软件(Apache & Nginx)。这个库依赖 EPEL 。首先要安装 epel-release

sudo yum install -y epel-release

然后安装CodeIT库:

cd /etc/ && wget / `rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo

或者访问:/
访问:/codeit.

在 /etc/目录下新建 codeit. ,内容如下:

[CodeIT]
name=CodeIT repo
baseurl=/packages/centos/7/$basearch
enabled=1
gpgkey=/RPM-GPG-KEY-codeit
gpgcheck=1

运行更新,
httpd版本信息如下:

yum info httpd
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * epel: 
 * remi-php72: 
 * remi-safe: 
已安装的软件包
名称    :httpd
架构    :x86_64
版本    :2.4.51
发布    :.el7
大小    :4.3 M
源    :installed
来自源:CodeIT
简介    : Apache HTTP Server
网址    :/
协议    : ASL 2.0
描述    : The Apache HTTP Server is a powerful, efficient, and extensible
         : web server.

运行 yum install httpd 即可安装更新httpd到最新版本。