I ran into the same error message when attempting to create an Amazon Linux 2 instance using the AWS CDK. The CDK currently defaults to Amazon Linux instead of Amazon Linux 2. When you accidentally use an Amazon Linux AMI from 2018, surprise surprise, all sorts of facilities are not available. I posted an easy way to check your version in another answer.
In CDK (and Cloud Formation) make sure to declare your intended generation in your AmazonLinuxImage properties
generation: AmazonLinuxGeneration.AMAZON_LINUX_2
Answer from Derek Bennett on serverfault.comnode.js - sudo: amazon-linux-extras: command not found - Stack Overflow
ansible - amazon-linux-extras enable vs install - Stack Overflow
Docker installation gives an error on Amazon Linux 2 when following the official documentation. Any ideas how to fix this?
ssh - Error: sudo: amazon-linux-extras: command not found - Stack Overflow
I ran into the same error message when attempting to create an Amazon Linux 2 instance using the AWS CDK. The CDK currently defaults to Amazon Linux instead of Amazon Linux 2. When you accidentally use an Amazon Linux AMI from 2018, surprise surprise, all sorts of facilities are not available. I posted an easy way to check your version in another answer.
In CDK (and Cloud Formation) make sure to declare your intended generation in your AmazonLinuxImage properties
generation: AmazonLinuxGeneration.AMAZON_LINUX_2
It looks like this issue is potentially being caused by YUM priorities. You could try disabling priorities to see if that is the issue. The config file used to disable yum priorities can be found here.
/etc/yum/pluginconf.d/priorities.conf
Change the config to be "enabled = 0" and try again.
Check the Amazon image version of your EC2 instance.
Command: cat /etc/image-id
If it is Amazon Linux 2023, it does not have extras.
However, most of the packages are already included in the distro.
You can run sudo yum install nginx which will install version 1.22
For Amazon Linux 2023 VM, follow the below steps
sudo yum update
sudo yum install stress
Generate CPU stress: stress --cpu <number-of-threads>
Generate memory stress: stress --vm <number-of-threads> --vm-bytes <memory-size>
Generate I/O stress: stress --io <number-of-threads>
Generate disk stress: stress --hdd <number-of-threads>
-
I want to install docker 27.2.0 on amazon linux 2
-
I followed the guide as mentioned here
It gives me an error
sudo yum install -y yum-utils sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
I am immediately running into this error
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
https://download.docker.com/linux/centos/2/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
One of the configured repositories failed (Docker CE Stable - x86_64),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=docker-ce-stable ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable docker-ce-stable
or
subscription-manager repos --disable=docker-ce-stable
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=docker-ce-stable.skip_if_unavailable=true
failure: repodata/repomd.xml from docker-ce-stable: [Errno 256] No more mirrors to try.
https://download.docker.com/linux/centos/2/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not FoundAnyone knows how to get docker running inside Amazon Linux 2 EC2 instance?
Just to clarify i am trying to run this inside EC2 user data script in case that matters
Hey All,
I use Ansible to provision my servers, and now that nginx and python3 have been moved into amazon-linux-extras in Amazon Linux 2, I'm wondering the best way to script the install process?
Before I could just use ansible's yum module and give it a list of packages to install.
What should I do now? Just use the shell module and hardcode a cli command?