nginx, aws, amazon linux 2,

How to install Nginx on Amazon Linux 2

Oct 05, 2021 · 1 min read · Post a comment

Installing Nginx from the Amazon Linux repo will provide you with an exceedingly old Nginx version. Therefore, I will show you how to install it through the EPEL repo which is my preferred choice when it comes to an RHEL Linux-based distro.


  • Amazon Linux 2
  • sudo privileges

Enable and Install EPEL repo on AWS EC2 Amazon Linux 2 instance

Step 1. First, check if the EPEL repository is enabled.

sudo amazon-linux-extras list | grep epel

If you get the following output:

24  epel      available    [ =7.11  =stable ]

Then, it means that you should enable it before installing Nginx.

Step 2. Enable the EPEL repo on Amazon Linux 2 instance.

sudo amazon-linux-extras enable epel

Step 3. Now, you should be able to install the EPEL repo.

sudo yum install epel-release

Install Nginx on AWS EC2 Amazon Linux 2 instance

Step 1. Once the EPEL repo is installed you can install the Nginx latest version as well.

sudo yum install nginx

Step 2. Verify installation.

nginx -v


nginx version: nginx/1.20.1


This tutorial is aimed to provide you with a quick and safe path of installing Nginx on Amazon Linux 2 instance. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.