When referencing the page https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#stable_vs_mainline

I have added the following repo entry /etc/yum.repos.d/nginx.repo

name=nginx repo

Then ran the install command yum --disablerepo=amzn-main --disablerepo=amzn-updates install nginx

Getting this error

Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.17.1-1.el7.ngx will be installed
--> Processing Dependency: systemd for package: 1:nginx-1.17.1-1.el7.ngx.x86_64
--> Processing Dependency: systemd for package: 1:nginx-1.17.1-1.el7.ngx.x86_64
--> Processing Dependency: libpcre.so.1()(64bit) for package: 1:nginx-1.17.1-1.el7.ngx.x86_64
--> Finished Dependency Resolution
Error: Package: 1:nginx-1.17.1-1.el7.ngx.x86_64 (nginx)
           Requires: systemd
Error: Package: 1:nginx-1.17.1-1.el7.ngx.x86_64 (nginx)
           Requires: libpcre.so.1()(64bit)

Is this the best approach or is there another approach that anyone would suggest?

  • You posted the nginx YUM repository for RHEL 6, but your error suggests you were downloading packages for RHEL 7. Double check what system you are on and what repositories should be enabled. – GracefulRestart Jul 11 '19 at 2:22

It all depends whether you are on Amazon Linux 1 (2018.03) or Amazon Linux 2.

Check the /etc/os-release file to find out which one you have.

Amazon Linux 1

/etc/os-release contains:

NAME="Amazon Linux AMI"
ID_LIKE="rhel fedora"
PRETTY_NAME="Amazon Linux AMI 2018.03"

The AWS repo for Amazon Linux 1 only has nginx version 1.14.1:

0» yum info nginx
Loaded plugins: priorities, update-motd, upgrade-helper
1070 packages excluded due to repository priority protections
Available Packages
Name        : nginx
Arch        : x86_64
Epoch       : 1
Version     : 1.14.1
Release     : 2.34.amzn1

Amazon Linux 2

/etc/os-release contains:

NAME="Amazon Linux"
ID_LIKE="centos rhel fedora"
PRETTY_NAME="Amazon Linux 2"

At the time of writing, AL2 only has nginx 1.12.2:

» amazon-linux-extras list | grep nginx
  4  nginx1.12                available    [ =1.12.2 ]

Installing stock version

Installing the stock version is easy. For AL1, do yum install nginx and for AL2 do amazon-linux-extras install nginx1.12.

Compile it yourself

To run a cutting edge version of nginx, you probably need to compile it yourself or ask AWS to update their packages. To compile nginx yourself, see the excellent instructions by Lee Benson here: https://stackoverflow.com/questions/37082406/how-to-install-nginx-1-9-15-on-amazon-linux-disto

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.