Installing NGINX on Red Hat 8

Before installing the NGINX, we need know your opensource version:

  • Mainline – Includes the latest features and bug fixes and is always up to date. It is reliable, but it may include some experimental modules, and it may also have some number of new bugs.
  • Stable – Doesn’t include all of the latest features, but has critical bug fixes that are always backported to the mainline version. We recommend the stable version for production servers.

Even in production I like install the Mainline version, I see must problem using Stable version because the bugs (including disk space on partition of the cache). In this guide, I explain how to install Stable and Mainline version using Nginx Repository.

Frist we need install yum-utils

sudo yum install yum-utils

sudo yum install yum-utils

After installed yum-utils, we let’s create nginx.repo file

[[email protected] ~]# vim /etc/yum.repos.d/nginx.repo

Insert the following line in the file:

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

Save the file and update the repository

[[email protected] ~]# yum update -y

By default, the repository for stable nginx package is used, to install nginx, run the command:

[[email protected] ~]# yum install nginx -y

Check the nginx version

[[email protected] ~]# nginx -v
nginx version: nginx/1.18.0

If you would like to use Mainline, run the command:

[[email protected] ~]# yum-config-manager --enable nginx-mainline

Install or update nginx.

[[email protected] ~]# yum install nginx -y

or

[[email protected] ~]# yum update nginx -y

Check the nginx version

[[email protected] ~]# nginx -v
nginx version: nginx/1.19.6

References:
https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/
http://nginx.org/en/linux_packages.html

Add your review

Your email address will not be published.

seventeen − 8 =