How to upgrade nginx from 1.16 to 1.18 on centos7

Viewed 1710

I'd like to upgrade my nginx from version 1.16 to 1.18.

Belows were previous situation about nginx.

[root@localhost ~]# rpm -qa | grep nginx
nginx-mod-mail-1.16.1-1.el7.x86_64
nginx-1.16.1-1.el7.x86_64
nginx-filesystem-1.16.1-1.el7.noarch
nginx-mod-http-image-filter-1.16.1-1.el7.x86_64
nginx-mod-http-xslt-filter-1.16.1-1.el7.x86_64
nginx-mod-http-perl-1.16.1-1.el7.x86_64
nginx-mod-stream-1.16.1-1.el7.x86_64
nginx-all-modules-1.16.1-1.el7.noarch

Then I removed nginx version 1.16, and tried to install version 1.18 after registering nginx yum repository. And I found out that there are no dependent rpms needed for nginx 1.18

Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.18.0-2.el7.ngx will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================
 Package                    Arch                        Version                                   Repository                  Size
===================================================================================================================================
Installing:
 nginx                      x86_64                      1:1.18.0-2.el7.ngx                        nginx                      769 k

Transaction Summary
===================================================================================================================================
Install  1 Package

Total download size: 769 k
Installed size: 2.7 M
Is this ok [y/d/N]:

Is there no need to install below rpms for nginx 1.18? If so, are there any other additional rpms needed for nginx 1.18?

nginx-mod-mail-1.16.1-1.el7.x86_64
nginx-1.16.1-1.el7.x86_64
nginx-filesystem-1.16.1-1.el7.noarch
nginx-mod-http-image-filter-1.16.1-1.el7.x86_64
nginx-mod-http-xslt-filter-1.16.1-1.el7.x86_64
nginx-mod-http-perl-1.16.1-1.el7.x86_64
nginx-mod-stream-1.16.1-1.el7.x86_64
nginx-all-modules-1.16.1-1.el7.noarch
2 Answers

When switching from EPEL-packaged builds of NGINX to nginx.org (or getpagespeed.com) builds, after installing newer NGINX, you need to run:

yum remove $(yum list installed | grep 'nginx.*@epel' | awk '{ print $1 }')

This will remove any extraneous packages like nginx-mod-stream. They are not needed because their files and features are already included to the main package nginx.

Related