Jump to content

How to install latest Stable/mainline Nginx in CWP, Centos 8/9 stream, AlmaLinux 8/9, RockyLinux 8/9

Featured Replies

Posted
comment_84

In this tutorial we'll learn how we can enable and install Latest stable version of nginx in centos Stream , almalinux and rockylinux. By default This OS have old version of nginx installed from nginx stream module. 

To install latest version of nginx stable or mainline do the steps

Step 1

Disable nginx module

dnf module disable nginx -y

Step 2

Add Official repository for nginx :

Create repository :

> /etc/yum.repos.d/nginx.repo
nano /etc/yum.repos.d/nginx.repo

For stable Nginx  and add this line :

[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

For mainline Nginx  and add this line :

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

Step 3

Remove any nginx version installed :

dnf remove nginx -y

Step 4 :

Install the latest version of nginx :

dnf install nginx -y
systemctl enable nginx
systemctl restart nginx

That's it you can now check the nginx version via this command : 

nginx -V

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now