add-apt-repository(1)

πŸ“¦
version 0.123 Β· 4 versions
, in ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ 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-line sources.list format. πŸ“

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

sources.list(5) apt-get(8)

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 🌈