带有 Nginx 的 Centos 7 服务器在更新软件包时报告错误

Joh*_*ard 6 installation nginx packages centos7 webmin

我有一个安装了 Nginx 的 CentOS 7 虚拟机。我使用 Webmin 来管理服务器。

它通常会自动安装更新,但是 nginx 更新失败,所以我尝试手动进行更新。它返回这个:

Installing package(s) with command /bin/yum -y install nginx ..
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.netsite.dk
 * epel: mirror.netsite.dk
 * extras: mirror.netsite.dk
 * updates: mirror.netsite.dk
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.20.1-9.el7 will be updated
--> Processing Dependency: nginx(abi) = 1.20.1 for package: 1:nginx-mod-mail-1.20.1-9.el7.x86_64
--> Processing Dependency: nginx(abi) = 1.20.1 for package: 1:nginx-mod-stream-1.20.1-9.el7.x86_64
--> Processing Dependency: nginx(abi) = 1.20.1 for package: 1:nginx-mod-http-perl-1.20.1-9.el7.x86_64
--> Processing Dependency: nginx(abi) = 1.20.1 for package: 1:nginx-mod-http-image-filter-1.20.1-9.el7.x86_64
--> Processing Dependency: nginx(abi) = 1.20.1 for package: 1:nginx-mod-http-xslt-filter-1.20.1-9.el7.x86_64
---> Package nginx.x86_64 1:1.20.2-1.el7.ngx will be an update
--> Finished Dependency Resolution
Error: Package: 1:nginx-mod-http-perl-1.20.1-9.el7.x86_64 (@epel)
           Requires: nginx(abi) = 1.20.1
           Removing: 1:nginx-1.20.1-9.el7.x86_64 (@epel)
               nginx(abi) = 1.20.1
           Updated By: 1:nginx-1.20.2-1.el7.ngx.x86_64 (nginx)
               Not found
Error: Package: 1:nginx-mod-stream-1.20.1-9.el7.x86_64 (@epel)
           Requires: nginx(abi) = 1.20.1
           Removing: 1:nginx-1.20.1-9.el7.x86_64 (@epel)
               nginx(abi) = 1.20.1
           Updated By: 1:nginx-1.20.2-1.el7.ngx.x86_64 (nginx)
               Not found
Error: Package: 1:nginx-mod-mail-1.20.1-9.el7.x86_64 (@epel)
           Requires: nginx(abi) = 1.20.1
           Removing: 1:nginx-1.20.1-9.el7.x86_64 (@epel)
               nginx(abi) = 1.20.1
           Updated By: 1:nginx-1.20.2-1.el7.ngx.x86_64 (nginx)
               Not found
Error: Package: 1:nginx-mod-http-image-filter-1.20.1-9.el7.x86_64 (@epel)
           Requires: nginx(abi) = 1.20.1
           Removing: 1:nginx-1.20.1-9.el7.x86_64 (@epel)
               nginx(abi) = 1.20.1
           Updated By: 1:nginx-1.20.2-1.el7.ngx.x86_64 (nginx)
               Not found
Error: Package: 1:nginx-mod-http-xslt-filter-1.20.1-9.el7.x86_64 (@epel)
           Requires: nginx(abi) = 1.20.1
           Removing: 1:nginx-1.20.1-9.el7.x86_64 (@epel)
               nginx(abi) = 1.20.1
           Updated By: 1:nginx-1.20.2-1.el7.ngx.x86_64 (nginx)
               Not found
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
.. install failed!
Run Code Online (Sandbox Code Playgroud)

我尝试运行建议的 rpm 命令,然后重做软件包更新。但这没有什么区别。

我还尝试安装其他 19 个软件包 - 它们都安装正确。然后我重试了 Nginx - 但它仍然失败并出现相同的错误...我还尝试依次禁用 nginx 存储库和 epel 存储库(以防两个存储库之间发生冲突) - 但这没有什么区别。

有谁知道是什么导致了这个问题 - 以及如何解决它?

提前致谢!

/约翰

joe*_*tra 5

我已经为我的系统解决了这个问题,尽管我的解决方案可能并不适用于所有人,具体取决于您是否使用nginx-*导致依赖性问题的模块。


我的解决方案是删除nginx-mod-http-perlnginx-mod-streamnginx-mod-mailnginx-mod-http-image-filternginx-mod-http-xslt-filter,然后我就可以获得yum upgrade最新的 nginx 版本。

编辑添加:除了删除这些软件包之外,我/etc/yum.repos.d/epel.repo还更新了exclude=nginx*, 以防止@epel重新安装提供的 nginx 软件包。

这对我有用,因为我实际上并没有使用这些包提供的功能;我有预感它们是由 Webmin(与 OP 一样,我也在使用)安装的,以支持它可以提供的一些功能。

如果您正在使用这些模块提供的功能,那么我认为至少目前的解决方案是禁用nginx repo,并在发布兼容模块时重新启用它@epel。如果您这样做,您将无法获得任何可用的 nginx 升级,因为 上没有可用的 1.20.2 @epel


核心问题似乎是你(和我)已经nginx-1.20.1-9.el7.x86_64 (@epel)安装了,但是两者@epelnginx启用了。

11 月 16 日左右,该nginx存储库发布了nginx-1.20.2,因此 yum 现在正在尝试更新到该版本。1.20.2但是,安装的各种nginx-*模块(无论是在 上@epel还是在 上)都没有相应的更新nginx,因此无法更新它们。这些模块还需要nginx(abi) = 1.20.1,这是提供的模块@epel(但nginx似乎没有提供),因此依赖性检查失败。

旁注:在我们的例子中,我们确实nginx在某个时间点安装了 -provided 核心包,并且在某个时间点用版本替换了它-@epel这是来自 yum 日志:

# zgrep -h nginx.x86 /var/log/yum.log-202* /var/log/yum.log
Apr 22 03:55:37 Updated: nginx.x86_64 1:1.18.0-1.el7.ngx
Oct 30 09:27:11 Updated: nginx.x86_64 1:1.18.0-2.el7.ngx
Apr 21 08:48:33 Updated: nginx.x86_64 1:1.20.0-1.el7.ngx
May 26 04:20:28 Updated: nginx.x86_64 1:1.20.1-1.el7.ngx
Jun 18 06:46:31 Installed: nginx.x86_64 1:1.20.1-2.el7
Oct 27 04:51:03 Updated: nginx.x86_64 1:1.20.1-9.el7
Run Code Online (Sandbox Code Playgroud)

6 月 18 日,该.ngx包裹已更换为 提供的包裹@epel。这可能与当前的问题相关,也可能无关。