AWS Yum repository makes software package management easy.

These repositories provide a single source of updates and avoid numerous copies of software applications.

Amazon users can make use of Amazon repositories to install different software packages. However, for specific packages, it may require a custom YUM repository.

That’s why we regularly receive requests to create an AWS Yum repository as part of our Server Management Services.

In this write-up, we’ll see how our Support Engineers create a yum repository in AWS server and fix related errors.

 

How we add repositories in Amazon Linux

Amazon Linux has two repositories by default, namely amzn-main and amzn-updates. As we already saw, to install specific packages, Amazon instance need custom Yum repository set up.

Here, we begin with adding the repository information to the /etc/yum.conf file or to its own repository.repo file in the /etc/yum.repos.d directory.

To add a yum repository to /etc/yum.repos.d, our Support Engineers follow the below steps.

1. Initially, we find the location of the .repo file. Again, depending on the repository you add, the location will differ.

For example,

https://www.domain.com/example.repo.

2. Next, we add the repository by using yum-config-manager command.

yum-config-manager --add-repo https://www.domain.com/example.repo

3. After that, we enable a yum repository in /etc/yum.repos.d with the following command.

yum-config-manager --enable epel

In addition, we use a command  yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm , to enable the EPEL repository on Amazon Linux 2.

That’s it, we have successfully added a yum repository on Amazon Linux.

However, we always ensure to enable only an authenticated repository to avoid security breaches on the server.

 

How we fixed common errors with Yum repository

From our experience in managing servers, we’ve seen customers facing problems after adding a new repository or while using it. Now, let’s check on how our Support Engineers resolve errors related to the AWS repository​.

 

1. Bad public DNS Settings

Recently, one of our customers reported that his Yum command did not work after creating a new yum repository on his AWS server. While installing a package, he got an error like,

Loaded plugins: priorities, update-motd, upgrade-helper
Could not retrieve mirrorlist http://repo.us-east-1.amazonaws.com/latest/main/mirror.list error was
12: Timeout on http://repo.us-east-1.amazonaws.com/latest/main/mirror.list: (28, 'Connection timed out after 10001 milliseconds')
One of the configured repositories failed (Unknown)

Then, our Support Engineers found this error caused due to bad public DNS settings of the EC2 instance.

Therefore, we solved this error by properly updating the public DNS as follows.

  1. We logged in to console.aws.amazon.com and selected Services > VPC
  2. Then, we selected the VPC connected to the EC2
  3. At last, we clicked Edit option > Change DNS hostnames to YES

 

That enabled the DNS hostname and the problem was solved.

 

2. Blocked traffic

Similarly, another customer got an error while running command yum install httpd. The error looked like as follow.

Loaded plugins: priorities, update-motd, upgrade-helper
http://packages.us-west-1.amazonaws.com/2013.09/main/201309001984/x86_64/repodata/repomd.xml?instance_id=i-923d2fc9&region=us-west-1: Errno 12 Timeout on http://packages.us-west-1.amazonaws.com/2013.09/main/201309001984/x86_64/repodata/repomd.xml?instance_id=i-923d2fc9&region=us-west-1: (28, 'Connection timed out after 10161 milliseconds')
Trying other mirror.

Error downloading packages:
generic-logos-17.0.0-2.5.amzn1.noarch: failure: Packages/generic-logos-17.0.0-2.5.amzn1.noarch.rpm from amzn-main: Errno 256 No more mirrors to try.

On checking, our Support Engineers found that the problem was with network ACL.

Also, he had a network ACL setup for the custom VPC subnet that blocked all inbound and outbound HTTP/ HTTPS traffic.

Therefore, we allowed HTTP and HTTPS traffic on the ACL network for the subnet that the instance sits in.

This fixed the problem and the installation of packages via Yum worked fine.

 

[Do you get trouble while creating AWS yum repository? Our AWS Experts can fix it for you.]

 

Conclusion

In a nutshell, users may face errors while creating an AWS yum repository, because of bad public DNS settings of an EC2 instance or incorrect ACL, network settings. Today, we saw how our Support Engineers set up YUM repository and fix related errors.



Source link

Author

Write A Comment