CentOS8的Yum仓库中内置的nginx版本是1.14.1
,最近漏扫提示需要升级至1.17.7
以上版本,记录一下yum命令使用中科大的镜像源简单粗暴有效更新的方法:
先添加中科大的镜像repo
$ sudo vim /etc/yum.repos.d/nginx.repo
使用mainline最新版本的repo
[nginx-mainline]
name=nginx mainline repo
baseurl=http://mirrors.ustc.edu.cn/nginx/mainline/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
module_hotfixes=true
就地升级
$ sudo yum update
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
nginx mainline repo 2.1 kB/s | 34 kB 00:16
Dependencies resolved.
===============================================================================================================================================================================================================
Package Architecture Version Repository Size
===============================================================================================================================================================================================================
Upgrading:
nginx x86_64 1:1.17.10-1.el8.ngx nginx-mainline 806 k
Transaction Summary
===============================================================================================================================================================================================================
Upgrade 1 Package
Total download size: 806 k
Is this ok [y/N]:y
确认版本
$ nginx -v
nginx version: nginx/1.17.10