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
Scripting amazon-linux-extras?
How to install docker on Amazon Linux2 - 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>
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?
Install Docker
sudo yum update -y
sudo yum -y install docker
Start Docker
sudo service docker start
Access Docker commands in ec2-user user
sudo usermod -a -G docker ec2-user
sudo chmod 666 /var/run/docker.sock
docker version
So sorry, it was my misunderstanding. My OS is Redhat Linux. I get to install docker by
yum-config-manager --enable rhui-REGION-rhel-server-extras
sudo yum -y install docker
systemctl start docker
systemctl enable docker
docker version