This time it’s a small story.
I needed to set up an instance on AWS Amazon EC2 for testing, and when I chose Amazon Linux 2023 for the test, I got a bit stuck.
If you search about installing nginx on Amazon Linux, you will find many blog posts about installing nginx using the amazon-linux-extras command. By the way, I asked ChatGPT, a recent hot topic, and got the same answer.
But with Amazon Linux 2023, it is unsympathetically as follows.
$ which amazon-linux-extras
/usr/bin/which: no amazon-linux-extras in (/home/ec2-user/.local/bin:/home/ec2-user/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)
Hmm? I checked and it seems that amazon-linux-extras has been discontinued.
It was listed in the list of Removed Packages here.
https://docs.aws.amazon.com/ja_jp/linux/al2023/release-notes/removed-packages.html
So, apparently, if you search with the dnf command normally, you can install it normally, like this.
$ sudo dnf search nginx
Last metadata expiration check: 0:09:56 ago on Thu May 11 02:44:35 2023.
============================================= Name Exactly Matched: nginx ==============================================
nginx.x86_64 : A high performance web server and reverse proxy server
============================================ Name & Summary Matched: nginx =============================================
collectd-nginx.x86_64 : Nginx plugin for collectd
nginx-all-modules.noarch : A meta package that installs all available Nginx modules
nginx-core.x86_64 : nginx minimal core
nginx-filesystem.noarch : The basic directory layout for the Nginx server
nginx-mimetypes.noarch : MIME type mappings for nginx
nginx-mod-devel.x86_64 : Nginx module development files
nginx-mod-http-image-filter.x86_64 : Nginx HTTP image filter module
nginx-mod-http-perl.x86_64 : Nginx HTTP perl module
nginx-mod-http-xslt-filter.x86_64 : Nginx XSLT module
nginx-mod-mail.x86_64 : Nginx mail modules
nginx-mod-stream.x86_64 : Nginx stream modules
So I installed it.
$ sudo dnf install nginx
Last metadata expiration check: 0:21:59 ago on Thu May 11 02:44:35 2023.
Dependencies resolved.
========================================================================================================================
Package Architecture Version Repository Size
========================================================================================================================
Installing:
nginx x86_64 1:1.22.1-1.amzn2023.0.3 amazonlinux 40 k
Installing dependencies:
generic-logos-httpd noarch 18.0.0-12.amzn2023.0.3 amazonlinux 19 k
gperftools-libs x86_64 2.9.1-1.amzn2023.0.2 amazonlinux 309 k
libunwind x86_64 1.4.0-5.amzn2023.0.2 amazonlinux 66 k
nginx-core x86_64 1:1.22.1-1.amzn2023.0.3 amazonlinux 583 k
nginx-filesystem noarch 1:1.22.1-1.amzn2023.0.3 amazonlinux 12 k
nginx-mimetypes noarch 2.1.49-3.amzn2023.0.3 amazonlinux 21 k
Transaction Summary
========================================================================================================================
Install 7 Packages
Total download size: 1.0 M
Installed size: 3.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): nginx-1.22.1-1.amzn2023.0.3.x86_64.rpm 367 kB/s | 40 kB 00:00
(2/7): gperftools-libs-2.9.1-1.amzn2023.0.2.x86_64.rpm 2.5 MB/s | 309 kB 00:00
(3/7): libunwind-1.4.0-5.amzn2023.0.2.x86_64.rpm 2.0 MB/s | 66 kB 00:00
(4/7): nginx-core-1.22.1-1.amzn2023.0.3.x86_64.rpm 3.8 MB/s | 583 kB 00:00
(5/7): nginx-mimetypes-2.1.49-3.amzn2023.0.3.noarch.rpm 563 kB/s | 21 kB 00:00
(6/7): nginx-filesystem-1.22.1-1.amzn2023.0.3.noarch.rpm 558 kB/s | 12 kB 00:00
(7/7): generic-logos-httpd-18.0.0-12.amzn2023.0.3.noarch.rpm 603 kB/s | 19 kB 00:00
------------------------------------------------------------------------------------------------------------------------
Total 4.1 MB/s | 1.0 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: nginx-filesystem-1:1.22.1-1.amzn2023.0.3.noarch 1/7
Installing : nginx-filesystem-1:1.22.1-1.amzn2023.0.3.noarch 1/7
Installing : nginx-mimetypes-2.1.49-3.amzn2023.0.3.noarch 2/7
Installing : generic-logos-httpd-18.0.0-12.amzn2023.0.3.noarch 3/7
Installing : libunwind-1.4.0-5.amzn2023.0.2.x86_64 4/7
Installing : gperftools-libs-2.9.1-1.amzn2023.0.2.x86_64 5/7
Installing : nginx-core-1:1.22.1-1.amzn2023.0.3.x86_64 6/7
Installing : nginx-1:1.22.1-1.amzn2023.0.3.x86_64 7/7
Running scriptlet: nginx-1:1.22.1-1.amzn2023.0.3.x86_64 7/7
Verifying : nginx-1:1.22.1-1.amzn2023.0.3.x86_64 1/7
Verifying : gperftools-libs-2.9.1-1.amzn2023.0.2.x86_64 2/7
Verifying : nginx-core-1:1.22.1-1.amzn2023.0.3.x86_64 3/7
Verifying : libunwind-1.4.0-5.amzn2023.0.2.x86_64 4/7
Verifying : nginx-mimetypes-2.1.49-3.amzn2023.0.3.noarch 5/7
Verifying : nginx-filesystem-1:1.22.1-1.amzn2023.0.3.noarch 6/7
Verifying : generic-logos-httpd-18.0.0-12.amzn2023.0.3.noarch 7/7
Installed:
generic-logos-httpd-18.0.0-12.amzn2023.0.3.noarch gperftools-libs-2.9.1-1.amzn2023.0.2.x86_64
libunwind-1.4.0-5.amzn2023.0.2.x86_64 nginx-1:1.22.1-1.amzn2023.0.3.x86_64
nginx-core-1:1.22.1-1.amzn2023.0.3.x86_64 nginx-filesystem-1:1.22.1-1.amzn2023.0.3.noarch
nginx-mimetypes-2.1.49-3.amzn2023.0.3.noarch
Complete!
Easy!
It is nice to be able to install in a more general way, but there are a lot of changes to packages other than nginx, so you should check the list and make sure you use them.