Linux command
add-apt-repository 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Add
add-apt-repository [repository_spec]
Remove
add-apt-repository -r [repository_spec]
Update
add-apt-repository --update [repository_spec]
Example
add-apt-repository -s [repository_spec]
Example
add-apt-repository ppa:[user]/[ppa-name]
List
add-apt-repository -L
说明
add-apt-repository is a Debian/Ubuntu utility that manages third-party APT repository sources. It can add entries to /etc/apt/sources.list or create individual files in /etc/apt/sources.list.d/, and can also remove previously added repositories. The tool is most commonly used to add PPAs (Personal Package Archives) from Launchpad, handling both the source list entry and the associated GPG key import automatically. It can optionally update the package cache after modifying sources.
参数
- -r, --remove
- Remove specified repository (disables matching lines; deletes empty source files)
- -y, --yes
- Assume affirmative responses to prompts
- -n, --no-update
- Skip package cache updates after adding repository
- -s, --enable-source
- Allow downloading of source packages from the repository
- -c, --component
- Specify repository component(s); defaults to 'main' if unspecified
- -p, --pocket
- Define pocket type (defaults to release pocket)
- -P, --ppa
- Add Ubuntu Launchpad Personal Package Archive (format: ppa:USER/PPA)
- -C, --cloud
- Add Ubuntu Cloud Archive (format: cloud-archive:CANAME)
- -U, --uri
- Add archive via single URI
- -S, --sourceslist
- Add archive using full sources.list format line
- -L, --list
- List currently configured repositories
- -l, --login
- Authenticate to Launchpad for private PPA access
- --dry-run
- Preview changes without executing them
- -d, --debug
- Output debug information
FAQ
What is the add-apt-repository command used for?
add-apt-repository is a Debian/Ubuntu utility that manages third-party APT repository sources. It can add entries to /etc/apt/sources.list or create individual files in /etc/apt/sources.list.d/, and can also remove previously added repositories. The tool is most commonly used to add PPAs (Personal Package Archives) from Launchpad, handling both the source list entry and the associated GPG key import automatically. It can optionally update the package cache after modifying sources.
How do I run a basic add-apt-repository example?
Run `add-apt-repository [repository_spec]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -r, --remove do in add-apt-repository?
Remove specified repository (disables matching lines; deletes empty source files)