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
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:
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:
This enabled a sub-repository with NGINX.
Now, list available versions by running:
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.