add-apt-repository(1)
β¨ add-apt-repository(1) β¨
Okay so this is the manual for add-apt-repository, the script that adds an external APT repository for you bestie π It can also remove one. Slay. π
πΈ NAME
add-apt-repository - Adds a repository into the /etc/apt/sources.list or /etc/apt/sources.list.d or removes an existing one π¦
π SYNOPSIS
add-apt-repository [OPTIONS] [LINE]
π DESCRIPTION
Okay so add-apt-repository is a script that adds an external APT repository to either /etc/apt/sources.list or a file in /etc/apt/sources.list.d/. It can also remove a repository that already exists. It's giving organized. β¨
π OPTIONS
Note that the --list, --ppa, --cloud, --uri, --sourceslist, and LINE parameters are mutually exclusive, so only one of them (or none) can be specified. No cap, don't try to mix them π
-h,--helpβ Shows the help message and exits. π§-d,--debugβ Prints debug information to the command line. π-r,--removeβ Removes the specified repository. ποΈ
Okay this one is kind of a process. It first disables (comments out) the matching line(s), and then any modified file(s) under sources.list.d/ get removed if they contain only empty and commented lines. π
It acts differently with --enable-source and/or --component. Without either of those, it removes the repository, including any deb-src line(s), and all components. With --enable-source, it only disables the 'deb-src' line(s). With --component, it removes only the specified component(s), and only removes the repository if no components are left. π«Ά
If both --enable-source and --component are used with --remove, the actions happen separately: the specified component(s) get removed from both deb and deb-src lines, and deb-src lines get disabled. Lowkey complicated but it works π
-y,--yesβ Assumes yes to all queries. Bestie is saying yes to everything π«Ά-n,--no-updateβ After adding the repository, does not update the package cache. π ββοΈ-l,--loginβ Logs in to Launchpad (this is only needed for private PPAs). π
An existing authentication token gets used, or a request to interactively authorize a new one gets made. It's saved in the desktop keyring (when available). To store the authentication token in a file instead, specify one with the environment variable LP_CREDENTIALS_FILE. π
-s,--enable-sourceβ Allows downloading of the source packages from the repository. π¦
This adds and enables a 'deb-src' line for the repository.
If this is used without any repository, it enables all currently existing disabled source repository (deb-src) entries that have a matching enabled binary repository (deb) entry. β¨
If this is used twice without any repository, it also adds missing source repository entries for all existing binary repository (deb) entries. Double the vibes π
-c,--componentβ Which component(s) should be used with the specified repository. π§©
If not specified, this defaults to main. It can be used multiple times to specify multiple components.
If this is used without any repository, it adds the component(s) to all currently existing (enabled) repositories, but only if they're listed in the main sources.list file. π
-p,--pocketβ What pocket to use. π
Defaults to none, which is equivalent to the release pocket.
If this is used without any repository, it adds the pocket to all currently existing repositories, but only if they're listed in the main sources.list file. It uses the components currently configured with the release pocket, or if that isn't configured, it uses the main and restricted components. π·
--dry-runβ Shows what would be done, but doesn't make any changes. π-L,--listβ Lists currently configured repositories. π
This only lists enabled repositories, so disabled repository lines won't show up. π
By default, this shows only binary (deb) repositories. If --enable-source is also used, it shows source (deb-src) repositories too. β¨
-P,--ppaβ Adds an Ubuntu Launchpad Personal Package Archive. π
Must be in the format ppa:USER/PPA, USER/PPA, or USER.
The USER parameter should be the Launchpad team or person that owns the PPA. The PPA parameter should be the name of the PPA; if it isn't provided, it defaults to 'ppa'.
The GPG public key of the PPA also gets downloaded and added to apt's keyring. π
To add a private PPA, you must also use the --login parameter, and of course you must also be subscribed to the private PPA. π
-C,--cloudβ Adds an Ubuntu Cloud Archive. βοΈ
Must be in the format cloud-archive:CANAME, uca:CANAME, or CANAME.
The CANAME parameter should be the name of the Cloud Archive. The CANAME parameter may optionally be suffixed with the pocket, as either -updates or -proposed. If not specified, the pocket defaults to -updates. π€οΈ
-U,--uriβ Adds an archive, specified as a single URI. π
If the URI is detected to be a PPA, this operates as if the --ppa parameter was used.
-S,--sourceslistβ Adds an archive, specified as a full source entry line in one-linesources.listformat. π
This must follow the ONE-LINE-STYLE format as described in the sources.list manpage.
If the URI is detected to be a PPA, this operates as if the --ppa parameter was used.
π§ LINE
Okay so LINE is a deprecated way to specify the repository to add or remove. It's only here for backwards compatibility. π It can be any of the supported formats: a sources.list line, a plain URI, a PPA shortcut, or a cloud-archive shortcut. It can also be one or more valid component(s). The script tries to detect which format you gave it.
This isn't recommended, because autodetection of the intended line format can be ambiguous. Older scripts may still use it though, so it's still around. π
One special case of LINE is the value -, which reads the LINE from stdin. π«§
π EXAMPLES
add-apt-repository -P ppa:user/repository
add-apt-repository -P user/repository
add-apt-repository -C cloud-archive:queens
add-apt-repository -C uca:queens
add-apt-repository -C queens
add-apt-repository -S 'deb http://myserver/path/to/repo stable main'
add-apt-repository -S deb http://myserver/path/to/repo stable main
add-apt-repository -U http://myserver/path/to/repo -c main
add-apt-repository -U https://packages.medibuntu.org -c free -c non-free
add-apt-repository -U http://extras.ubuntu.com/ubuntu
add-apt-repository -s
add-apt-repository -L
add-apt-repository -s -r
add-apt-repository -c universe
add-apt-repository -r -c multiverse
π DEPRECATED EXAMPLES
Old-school, but still here if you need them:
add-apt-repository deb http://myserver/path/to/repo stable main
add-apt-repository http://myserver/path/to/repo main
add-apt-repository https://packages.medibuntu.org free non-free
add-apt-repository http://extras.ubuntu.com/ubuntu
add-apt-repository multiverse
π¦ SEE ALSO
π COPYRIGHT
This manual page was written by Chow Loong Jin <hyperair@gmail.com> for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation.
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses.
Thanks for hanging out with me in the manpage today, bestie π«Ά Stay iconic and keep your repos tidy β¨ π add-apt-repository(1), General Commands Manual π
π¦ where this page comes from
- ubuntu noble: software-properties-common 0.99.48 Β· GPL-2.0-or-later
- ubuntu noble: software-properties-common 0.99.49.4 Β· GPL-2.0-or-later
- ubuntu questing: software-properties-common 0.114 Β· GPL-2.0-or-later
- ubuntu resolute: software-properties-common 0.120 Β· GPL-2.0-or-later
- ubuntu resolute: software-properties-common 0.120.1 Β· GPL-2.0-or-later
- ubuntu stonking: software-properties-common 0.123 Β· GPL-2.0-or-later
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms