We get the following error when trying to install a package, for example:- curl, using the Linux "apt-get" package manager.

error

This is a common case in EC2 instances launched with the Amazon Linux kernel. Amazon Linux kernel is the default AMI (Amazon Machine Image) when launching a new instance in AWS EC2.

What is the "apt-get" command not found?

This is because, in the Amazon Linux kernel, the default build-in package manager is not "apt-get". Instead,  they use the "yum" package manager in all of the Amazon Linux images.

How to install packages with Yum?

In the above example instead of running the command with "apt-get", replace it with "yum".

sudo yum install curl
installation with the yum package manager 
successful installation

What if it gave another error?

If you still face issues with installing packages, then this is most probably an AMI-specific issue. in which case, you need to search the internet with the specific AMI id related queries.

You can find the AMI id by:

1, Open the AWS EC2 console and click on the EC2 instance name.

2, In the information panel, scroll down to the Instance details section.

finding AMI id

3, Copy the AMI id and use it to search for AMI-specific queries on the internet.