apt-add-repository command not found - Amazon Linux

Page content

How to Install apt-add-repository Command on Amazon Linux

In Amazon Linux, the apt-add-repository command is not available by default. This command is commonly used in Debian-based systems to add external repositories. However, since Amazon Linux is based on CentOS, the apt-add-repository command is not compatible with this system.

Solution

To add external repositories in Amazon Linux, you can use the yum-config-manager command instead. This command allows you to enable or disable repositories in the YUM package manager.

To install the yum-utils package which includes yum-config-manager, you can use the following command:

sudo yum install yum-utils

Once yum-utils is installed, you can add a repository using the following syntax:

sudo yum-config-manager --add-repo=repository_url

Replace repository_url with the URL of the repository you want to add.

Conclusion

In Amazon Linux, the apt-add-repository command is not available due to the system being based on CentOS and using the YUM package manager instead of APT. By using the yum-config-manager command, you can achieve similar functionality in adding external repositories to your system.