添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
坚韧的啤酒  ·  押韵词典: 猖狂·  6 月前    · 
冷静的柑橘  ·  转-WebView ...·  7 月前    · 
Add repositories on an AL2 instance - Amazon Linux 2

Add repositories on an AL2 instance

This information applies to AL2 and Amazon Linux. For information about AL2023, see Using Deterministic upgrades through versioned repository in the AL2023 User Guide .

Note

The Amazon Linux AMI reached its end-of-life on December 31, 2023 and will not receive any security updates or bug fixes starting January 1, 2024. For more information about the Amazon Linux AMI end-of-life and maintenance support, see the blog post Update on Amazon Linux AMI end-of-life . We recommend that you upgrade applications to AL2023, which includes long-term support until 2028.

By default, Amazon Linux instances launch with the following repositories enabled:

AL2: amzn2-core and amzn2extra-docker

Amazon Linux AMI: amzn-main and amzn-updates

While there are many packages available in these repositories that are updated by Amazon Web Services, there might be a package that you want to install that is contained in another repository.

Important

This information applies to Amazon Linux. For information about other distributions, see their specific documentation.

To install a package from a different repository with yum , you need to add the repository information to the /etc/yum.conf file or to its own repository .repo file in the /etc/yum.repos.d directory. You can do this manually, but most yum repositories provide their own repository .repo file at their repository URL.

To determine what yum repositories are already installed
  • List the installed yum repositories with the following command:

    [ec2-user ~]$ yum repolist all

    The resulting output lists the installed repositories and reports the status of each. Enabled repositories display the number of packages they contain.

To add a yum repository to /etc/yum.repos.d
  1. Find the location of the .repo file. This will vary depending on the repository you are adding. In this example, the .repo file is at https://www. example .com/ repository .repo .

    Add the repository with the yum-config-manager command.

    [ec2-user ~]$ sudo yum-config-manager --add-repo https://www.example.com/repository.repo Loaded plugins: priorities, update-motd, upgrade-helper adding repo from: https://www.example.com/repository.repo grabbing file https://www.example.com/repository.repo to /etc/yum.repos.d/repository.repo repository.repo | 4.0 kB 00:00 repo saved to /etc/yum.repos.d/repository.repo

After you install a repository, you must enable it as described in the next procedure.

To enable a yum repository in /etc/yum.repos.d
  • Use the yum-config-manager command with the --enable repository flag. The following command enables the Extra Packages for Enterprise Linux (EPEL) repository from the Fedora project. By default, this repository is present in /etc/yum.repos.d on Amazon Linux AMI instances, but it is