4

I am trying to install nginx on AWS EC2 instance. As this is done using amazon-linux-extras as per AWS documentation, I tried that. But I am unable to find the package or install it using yum install(it says that the package is already available but I am unable to find it using 'which'.

Below is the terminal output. Please help.

[arjun@ip-172-31-32-27 ~]$ which amazon-linux-extras

/usr/bin/which: no amazon-linux-extras in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/arjun/.local/bin:/home/arjun/bin)

[arjun@ip-172-31-32-27 ~]$ sudo yum -y install amazon-linux-extras

[sudo] password for arjun:

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                                                                                                                                               | 2.4 kB  00:00:00

Package amazon-linux-extras-1.6.9-1.amzn2.noarch already installed and latest version

Nothing to do
4
  • Found the file in default python2.7 of my AWS Linux 2 instance. But I am still unable to resolve the issue. Used 'find' command and found amazon_linux_extras here: /usr/lib/python2.7/site-packages/amazon_linux_extras
    – Arjun
    Sep 30, 2019 at 15:34
  • Please note amazon-linux-extras has been removed in release 2022 doc Dec 7, 2022 at 16:18
  • @RichardTylerMiles - where is it documented that amazon-linux-extras has been removed? I'm having an issue where I'm trying to use the utility but it hangs silently when trying to install docker. However, a recent support post (01/25/2023) says to use it to upgrade the linux kernel here Feb 4 at 12:40
  • The disconnect is that Amazon Linux 2022 is the successor of Amazon Linux 2. Full Changes. Note al2 uses RHEL while al2022 is a Fedora spin off. Feb 5 at 17:27

2 Answers 2

0

All you need to do is:

amazon-linux-extras enable nginx

EDIT: This answer was valid in 2019. It looks like extras was removed as of Dec 2022.

3
  • 1
    It says that... -bash: amazon-linux-extras: command not found
    – Arjun
    Oct 1, 2019 at 5:37
  • Are using Amazon Linux 2 AMI or just Amazon Linux AMI? You can check with cat /etc/system-release Oct 1, 2019 at 20:54
  • Amazon Linux 2 AMI. I found a workaround to install nginx though: Using epel-release, that worked fine without the use of amazon-linux-extras...
    – Arjun
    Oct 4, 2019 at 6:27
0

So Nginx is preinstalled in Amazon Linux 2022, so really, you should upgrade the distribution you are using (Amazon Linux 2).

Generally, if you need to install on Amazon Linux 2 you should build from source. The code below is generally the method today, but it is typical to add/want extra modules which may modify the flags for ./auto/configure, for example. More information on how to build Nginx's repo into its executable can be found on its online documentation http://nginx.org/en/docs/configure.html.

git clone --quiet https://github.com/nginx/nginx.git

cd nginx || exit

./auto/configure --with-http_ssl_module --user=www-data --group=www-data

make

make install

nginx -t

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.