Upgrading Nginx Version with yum ~ CentOS 6

Tadashi Shigeoka ·  Thu, June 7, 2018

I’ll introduce the procedure for upgrading the version of Nginx installed with the yum command on CentOS 6.

Nginx

Adding yum Repository

First, if you don’t have the Nginx yum repository, add it as follows:

#/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

Checking Available Nginx Versions for yum Installation

With yum info nginx, I found that the currently installed Nginx version is 1.8.0 and the latest available version is 1.14.0.

yum info nginx

Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * elrepo: ftp.ne.jp
 * epel: mirror.dmmlabs.jp
 * remi: mirrors.mediatemple.net
 * remi-php56: mirrors.mediatemple.net
 * rpmforge: ftp.kddilabs.jp
 * rpmfusion-free-updates: free.nchc.org.tw
 * rpmfusion-nonfree-updates: free.nchc.org.tw
nginx                                                                                                                                   | 2.9 kB     00:00     
Installed Packages
Name        : nginx
Arch        : x86_64
Version     : 1.8.0
Release     : 1.el6.ngx
Size        : 872 k
Repo        : installed
From repo   : nginx
Summary     : High performance web server
URL         : http://nginx.org/
License     : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
            : a mail proxy server.

Available Packages
Name        : nginx
Arch        : x86_64
Version     : 1.14.0
Release     : 1.el6.ngx
Size        : 956 k
Repo        : nginx
Summary     : High performance web server
URL         : http://nginx.org/
License     : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
            : a mail proxy server.

Nginx Upgrade

Now, let’s upgrade the Nginx version.

Since this procedure stops the Nginx process, causing temporary service downtime, I recommend performing this work during low-traffic hours.

sudo service nginx stop
sudo yum update nginx -y
sudo service nginx start

Finally, let’s also verify the Nginx version just to be sure.

nginx -V
nginx version: nginx/1.14.0

That’s all from the Gemba where I upgraded to a new Nginx version.