By default, Amazon Linux instances launch with two repositories enabled:
amzn-updates. While there are many packages available in these repositories that are updated by Amazon Web Services, there may be a package that you wish to install that is contained in another repository.
These procedures are intended for use with Amazon Linux. For more 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 add a yum repository to /etc/yum.repos.d
- Find the location of the
.repofile. This will vary depending on the repository you are adding. In this example, the
.repofile is at
- Add the repository with the yum-config-manager command.
sudo yum-config-manager --add-repo https://www.
Loaded plugins: priorities, update-motd, upgrade-helper
adding repo from: https://www.
grabbing file https://www.
repository.repo to /etc/yum.repos.d/
repository.repo | 4.0 kB 00:00
repo saved to /etc/yum.repos.d/
To enable a yum repository in
- Use the yum-config-manager command with the
--enableflag. 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.don Amazon Linux instances, but it is not enabled.Copy1[ec2-user ~]$ <strong class="userinput"><code class=""><span class="">sudo</span> yum-config-manager --enable <em class="replaceable"><code>epel</code></em></code></strong>
For information on enabling the EPEL repository on other distributions, such as Red Hat and CentOS, see the EPEL documentation at https://fedoraproject.org/wiki/EPEL.