apt-add-repository
Add a new software package repository
TLDR
View documentation for the original command
SYNOPSIS
apt-add-repository [options] repository
PARAMETERS
-h, --help
Show this help message and exit
-m, --massive-debug
Print extensive debug information
-y, --yes
Assume yes to all queries, disable prompts
-k KEYSERVER, --keyserver=KEYSERVER
Keyserver URL (default: keyserver.ubuntu.com)
-r, --remove
Remove the specified repository
--list-keys
List unused GPG keys in the system
--update
Run apt update after adding repository
--no-update
Skip apt update after adding (default)
--enable-src
Enable source code downloads from repo
--disable-src
Disable source code downloads (default)
DESCRIPTION
apt-add-repository is a command-line utility for Debian-based distributions like Ubuntu, used to add third-party APT repositories and Personal Package Archives (PPAs) to the system's software sources. It automates the process of appending repository entries to /etc/apt/sources.list.d/, fetching and installing GPG signing keys from keyservers, and optionally running apt update.
The tool is essential for installing software from sources beyond official repositories, such as Launchpad PPAs. For PPAs, use the simple syntax ppa:user/ppa; for custom repos, provide a full deb line like deb http://example.com/repo stable main. It handles key import securely but prompts for confirmation unless -y is used.
Part of the software-properties-common package, it requires root privileges (typically via sudo). After adding repos, updating package lists ensures new sources are recognized. Misuse with untrusted repos risks security, as malicious packages could be installed.
CAVEATS
Requires sudo for root access. Untrusted repositories pose security risks via malicious packages. Key import may fail if keyserver is unreachable or blocked. Not available on non-Debian systems without equivalent tools.
PPA USAGE
Add Launchpad PPA with sudo apt-add-repository ppa:username/ppa. Automatically handles distribution codename.
CUSTOM REPO EXAMPLE
sudo apt-add-repository 'deb https://example.com/repo stable main'
Follow with sudo apt update.
HISTORY
Introduced in Ubuntu 9.10 (Karmic Koala) as part of python-software-properties to simplify PPA support. Evolved into software-properties-common package. Widely adopted in Debian derivatives for repo management.


