How to Install Security Update on CentOs 8 and Installing NGNIX

Sharon Johnson
4 min readJan 18, 2023

--

CentOS is a Linux distribution that provides a free and open-source community-supported computing platform

What is a NGNIX? Nginx [engine X] is a free and open-source high-performance web server. It also acts as a reverse proxy server and load balancer.

Instructions as follows:

  1. Login to your cloud server using the ssh command:
    ssh user@cloud-server-ip
  2. Search for Nginx package:
    sudo yum search nginx

You should see this:

  1. Install nginx package using the yum command on CentOS 8:
    sudo yum update
    sudo yum install nginx
  1. Update firewall settings and open TCP port 80 and 443. Run:
    sudo firewall-cmd — permanent — zone=public — add-service=https — add-service=http
    sudo firewall-cmd — reload

Make sure you see Success and then proceed to next step

Step 1 — Update the system

Update system and Kernel: update all installed packages for security is an essential. So update the system, run:
$ sudo yum updateinfo
$ sudo yum update (move on to next step if you see Complete!
##
Reboot the system if a new kernel update was installed ##
$ sudo reboot

Step 2 — Search for Nginx package

Is web server available?

$ sudo yum search nginx (If you are seeing this move to the next step)

$ sudo yum list nginx (If you are seeing this move to the next step)

What version of Nginx am I going to install? To get the Nginx version information that you are going to install, execute:
$ sudo yum info nginx (If you are seeing this move to the next step)

Lists all Nginx module streams, their profiles and states using the following dnf command:
$ sudo yum module list nginx

Step 3 — Installing Nginx on CentOS 8

To install the latest stable nginx server, run the following yum command:
$ sudo yum install nginx

Step 4 — Enable nginx server

First, enable nginx service by running systemctl command so that it starts at server boot time:
$ sudo systemctl enable nginx

Start the service, run:
$ sudo systemctl start nginx

Commands to start/stop/restart nginx server

Run command as per your needs.
$ sudo systemctl start nginx ## <-- start the server ##
$ sudo systemctl stop nginx ## <-- stop the server ##
$ sudo systemctl restart nginx ## <-- restart the server ##
$ sudo systemctl reload nginx ## <-- reload the server ##

$ sudo systemctl status nginx ## <-- get status of the server ##

Example of what you should be seeing

Step 5 — Open port 80 and 443 using firewall-cmd

You must open and enable port 80 and 443 using the firewall-cmd command:
$ sudo firewall-cmd --permanent --zone=public --add-service=http --add-service=https
$ sudo firewall-cmd --reload
$ sudo firewall-cmd --list-services --zone=public

Step 6 — Test it

Verify that TCP port 80 or 443 opened using ss command command:
$ sudo ss -tulpn

If you do not know your server IP address run the following ip command:
$ ip a

Once you locate your IP address type your web browser and you should get something that look like this:

You have now installed NGINX on your CentOS 8 Server

--

--

No responses yet