skip to Main Content

How to install Nginx with an exact version on Amazon Linux 2?

What I tried

  • sudo yum install nginx
  • sudo amazon-linux-extras install nginx1
  • sudo yum install nginx:1.14.2

Both get nginx 1.20.0 or no package available. How can I get other versions, ex: nginx 1.14.2?

2

Answers


  1. You can install any nginx versions.

    Check this: https://centos.pkgs.org/7/nginx-x86_64/nginx-1.14.2-1.el7_4.ngx.x86_64.rpm.html

    If you wanna install nginx 1.14.2 follow this:

    wget https://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.14.2-1.el7_4.ngx.x86_64.rpm
    sudo rpm -Uvh nginx-1.14.2-1.el7_4.ngx.x86_64.rpm
    nginx -v
    
    Login or Signup to reply.
  2. The accepted answer isn’t really good because it references installing direct RPM as opposed to using repositories which provides better security and easy updates in the future.

    The Amazon Linux way is the following.

    First, enable the NGINX repository provided by Amazon:

    amazon-linux-extras enable nginx1
    

    This enabled a sub-repository with NGINX.

    Now, list available versions by running:

    yum info nginx --showduplicates
    

    From there, you can decipher that 1.14.2 is not available specifically for Amazon Linux. But that does not mean that you should install random other direct RPM via URL.

    Use the closest nearest NGINX version to your requirements, e.g.

    yum install nginx-1.16.1
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search