add-apt-repository
Add a new APT software repository
TLDR
Add a new apt repository
Remove an apt repository
Update the package cache after adding a repository
Allow source packages to be downloaded from the repository
SYNOPSIS
add-apt-repository [options] repository
PARAMETERS
-h, --help
Show help message and exit.
-y, --yes
Assume yes to all queries and do not prompt.
-n, --no-update
Do not run apt update after adding the repository.
--remove
Remove the specified repository.
--update
Run apt update after adding the repository (default). Cannot be used with --no-update.
repository
The repository to add. This can be a PPA (ppa:user/ppa-name), a deb URL (deb http://example.com/debian distribution component), or a deb-src URL (deb-src http://example.com/debian distribution component).
DESCRIPTION
The add-apt-repository command simplifies adding new software repositories to your system's list of package sources. It automatically updates the APT (Advanced Package Tool) configuration files located in /etc/apt/sources.list or /etc/apt/sources.list.d/. This allows APT to find and install software packages from these newly added repositories. By using this command, you avoid manually editing configuration files, minimizing the risk of errors. add-apt-repository can also import the repository's key, if available, to ensure packages are authentic and haven't been tampered with. The command supports various repository types including PPA (Personal Package Archive), deb and deb-src entries.
Warning: Adding untrusted repositories can compromise your system's security. Verify the source before adding it.
CAVEATS
Adding untrusted repositories can pose a security risk. Always verify the source of a repository before adding it to your system. Removing a PPA added using a distribution tool can leave behind the key used to verify it. This may be resolved by purging the package associated with the added key.
It is important to keep repositories updated by using "apt update"
REPOSITORY FORMATS
add-apt-repository supports several repository formats:
1. PPA: Personal Package Archives hosted on Launchpad, e.g., ppa:user/ppa-name.
2. Deb: Standard Debian package repositories, specified with a URL, distribution name, and component, e.g., deb http://example.com/debian buster main.
3. Deb-src: Debian source package repositories, similar to deb but providing source code.
HISTORY
The add-apt-repository command was originally developed by Canonical to simplify the process of adding PPAs (Personal Package Archives) on Ubuntu systems. Over time, its functionality has been extended to support other types of repositories. It's now widely used in Debian-based distributions to manage package sources more easily. The command abstracts away the complexities of manually editing APT configuration files, making it a convenient tool for users of all skill levels.