apt-add-repository: command not found

apt-add-repository is a command-line tool that is used to add a new package repository to the list of repositories available to the apt package manager. It is included in the software-properties-common package, which is installed by default on many popular Linux distributions such as Ubuntu and Debian.

To use apt-add-repository, you need to provide it with the repository’s location, which is typically specified as a URL. For example, to add the repository for the Google Chrome browser, you can use the following command:

# sudo apt-add-repository "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main"

This will add the specified repository to the list of available repositories, allowing you to install packages from that repository using the apt package manager.

Note that apt-add-repository is primarily used to add third-party repositories to a system. Most Linux distributions come with a set of default repositories that are configured by default, and you can install packages from these repositories using the apt package manager without the need to add any additional repositories.

If you encounter the below error while running the apt-add-repository command:

apt-add-repository: command not found

you may try installing the below package:

# apt-get install software-properties-common

apt-add-repository Command Examples

1. Add a new apt repository:

# apt-add-repository {{repository_spec}}

2. Remove an apt repository:

# apt-add-repository --remove {{repository_spec}}

3. Update the package cache after adding a repository:

# apt-add-repository --update {{repository_spec}}

4. Enable source packages:

# apt-add-repository --enable-source {{repository_spec}}
Related Post