- How to List Installed Repositories In Ubuntu & Debian
- List Installed Repositories In Ubuntu
- Conclusion
- Repositories / CommandLine
- The Basics
- Explanation of the Repository Format
- Other Versions
- Adding Repositories
- Adding the Universe and Multiverse Repositories
- Adding Partner Repositories
- Adding Other Repositories
- Adding Launchpad PPA Repositories
- Enabling Repositories with a (non-interactive) Script
- Suggestions & Recommendations
- Further Reading
- 🐧 Как вывести список установленных репозиториев в Ubuntu и Debian
- Список установленных репозиториев в Ubuntu
- Заключение
How to List Installed Repositories In Ubuntu & Debian
A repository is the collection of packages for a Linux operating system. You can create a central repository containing the actual packages. Then configure your other systems to connect with the main repository. From where, you can install, update packages.
The Ubuntu and other Debian based systems uses APT (Advanced Packages Tool) as package manager. Apt keeps all the configuration files under /etc/apt directory.
This tutorial will help you to list all installed repositories under a Ubuntu or Debian based system via command line.
List Installed Repositories In Ubuntu
The remote repository references are configured in /etc/apt/sources.list file and all files under /etc/apt/sources.list.d/ directory.
Use the following command to list all the configured repositories on apt based system:
sudo grep -rhE ^deb /etc/apt/sources.list*
You will see the output like below:
deb http://mirrors.digitalocean.com/ubuntu/ xenial main restricted deb-src http://mirrors.digitalocean.com/ubuntu/ xenial main restricted deb http://mirrors.digitalocean.com/ubuntu/ xenial-updates main restricted deb-src http://mirrors.digitalocean.com/ubuntu/ xenial-updates main restricted deb http://mirrors.digitalocean.com/ubuntu/ xenial universe deb-src http://mirrors.digitalocean.com/ubuntu/ xenial universe . . . deb http://security.ubuntu.com/ubuntu xenial-security universe deb-src http://security.ubuntu.com/ubuntu xenial-security universe deb http://security.ubuntu.com/ubuntu xenial-security multiverse deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
Alternatively, you can use apt-cache command to list all repositories. This command will provide also provide more details about the repository.
Package files: 100 /var/lib/dpkg/status release a=now 500 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 Packages release v=16.04,o=LP-PPA-ondrej-php,a=xenial,n=xenial,l=***** The main PPA for supported PHP versions with many PECL extensions *****,c=main,b=amd64 origin ppa.launchpad.net 500 https://deb.nodesource.com/node_13.x xenial/main amd64 Packages release o=Node Source,n=xenial,l=Node Source,c=main,b=amd64 origin deb.nodesource.com . . . 500 http://mirrors.digitalocean.com/ubuntu xenial/main amd64 Packages release v=16.04,o=Ubuntu,a=xenial,n=xenial,l=Ubuntu,c=main,b=amd64 origin mirrors.digitalocean.com Pinned packages:
Conclusion
In this tutorial, you have learned to find all the repositories configured on Ubuntu or Debian based system.
Repositories / CommandLine
This page describes how to manage software repositories from the command line. (GUI tools are also available: Managing Repositories in Ubuntu or Kubuntu).
If you are using a minimal install or server install you will need to be familiar with a terminal based text editor like nano. If you are using a GUI install you can use Nano or GEdit.
The Basics
Ubuntu uses apt for package management. Apt stores a list of repositories or software channels in the file
and in any file with the suffix .list under the directory
See man sources.list for more about this storage mechanism.
By editing these files from the command line, we can add, remove, or temporarily disable software repositories.
- Note: It’s always a good idea to backup a configuration file like sources.list before you edit it. To do so, issue the following command:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
Typically, the beginning of the file /etc/apt/sources.list looks like this:
# sources.list #deb cdrom:[Ubuntu 13.10 _Saucy Salamander_ - Release i386 (20131016.1)]/ saucy main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted deb-src http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted #.
Explanation of the Repository Format
- All the lines beginning with one or two hashes (#) are comments, for information only.
- The lines without hashes are apt repository lines. Here’s what they say:
- deb: These repositories contain binaries or precompiled packages. These repositories are required for most users.
- deb-src: These repositories contain the source code of the packages. Useful for developers.
- http://archive.ubuntu.com/ubuntu: The URI (Uniform Resource Identifier), in this case a location on the internet. See the official mirror list or the self-maintained mirror list to find other mirrors.
- saucy is the release name or version of your distribution.
- main & restricted are the section names or components. There can be several section names, separated by spaces.
Other Versions
- For other Ubuntu releases you would replace the ‘saucy’ with the current version you have installed (‘precise’, ‘quantal’, ‘raring’, ‘saucy’, ‘trusty’, . ) Type lsb_release -sc to find out your release.
Adding Repositories
Adding the Universe and Multiverse Repositories
deb http://us.archive.ubuntu.com/ubuntu/ saucy universe deb-src http://us.archive.ubuntu.com/ubuntu/ saucy universe deb http://us.archive.ubuntu.com/ubuntu/ saucy-updates universe deb-src http://us.archive.ubuntu.com/ubuntu/ saucy-updates universe
There are four similar lines for ‘multiverse’.
sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ saucy universe multiverse" sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ saucy-updates universe multiverse"
Depending on your location, you should replace ‘us.’ by another country code, referring to a mirror server in your region. Check sources.list to see what is used!
Type lsb_release -sc to find out your release. You may repeat the commands with «deb-src» instead of «deb» in order to install the source files.
Adding Partner Repositories
deb http://archive.canonical.com/ubuntu saucy partner deb-src http://archive.canonical.com/ubuntu saucy partner
Be aware that the software contained within this repository is NOT open source.
Adding Other Repositories
There are some reasons for which you might want to add non-Ubuntu repositories to your list of software sources. Caution: To avoid trouble with your sytem, only add repositories that are trustworthy and that are known to work on Ubuntu systems!
- You can add custom software repositories by adding the apt repository line of your software source to the end of the sources.list file. It should look something like this:
deb http://mirror3.ubuntulinux.nl/ hardy-seveas freenx
Adding Launchpad PPA Repositories
- The command updates your sources.list file or adds/edits files under sources.list.d/. Type man add-apt-repository for detailed help.
- If a public key is required and available it is automatically downloaded and registered.
- Should be installed by default. On older or minimal Ubuntu releases, you may have to install software-properties-common and/or python-software-properties first (sudo apt-get install python-software-properties)
sudo add-apt-repository ppa:
Enabling Repositories with a (non-interactive) Script
This section seemed obsolete due to the add-apt-repository command, thus it has been removed.
Suggestions & Recommendations
- It is always a good idea to back up configuration files like /etc/apt/sources.list before you begin editing. You can then revert your changes if needed.
- If you decide to add other repositories to sources.list, make sure that the repository is meant to work (and known to work) with Ubuntu. Repositories that are not designed to work with your version of Ubuntu can introduce inconsistencies in your system and might force you to re-install. Also, make sure that you really need to add external repositories as the software package(s) you are looking for may already have been introduced into the official repositories!
- Please keep in mind that it may not be legal (typically because of export restrictions) to enable some non-Ubuntu software repositories in some countries.
- You may be asked enter a security key when adding a non-Ubuntu repository to your sources. See Managing Authentication Keys for instructions.
- Remember to retrieve updated package lists by issuing a sudo apt-get update when you’re done editing sources.list.
Further Reading
Repositories/CommandLine (последним исправлял пользователь 2580DCEA 2015-07-27 15:42:33)
The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details
🐧 Как вывести список установленных репозиториев в Ubuntu и Debian
Репозиторий – это набор пакетов для операционной системы Linux.
Оттуда вы можете устанавливать, обновлять пакеты.
Ubuntu и другие системы на основе Debian используют APT (Advanced Packages Tool) в качестве диспетчера пакетов.
Apt хранит все файлы конфигурации в каталоге /etc/apt.
Это руководство поможет вам составить список всех установленных репозиториев в системе на основе Ubuntu или Debian через командную строку.
Список установленных репозиториев в Ubuntu
Ссылки на удаленные репозитории настраиваются в файле /etc/apt/sources.list и во всех файлах в каталоге /etc/apt/sources.list.d/.
Используйте следующую команду, чтобы вывести список всех настроенных репозиториев в системе на основе apt:
sudo grep -rhE ^deb /etc/apt/sources.list*
Вы увидите результат, как показано ниже:
deb http://mirrors.digitalocean.com/ubuntu/ xenial main restricted deb-src http://mirrors.digitalocean.com/ubuntu/ xenial main restricted deb http://mirrors.digitalocean.com/ubuntu/ xenial-updates main restricted deb-src http://mirrors.digitalocean.com/ubuntu/ xenial-updates main restricted deb http://mirrors.digitalocean.com/ubuntu/ xenial universe deb-src http://mirrors.digitalocean.com/ubuntu/ xenial universe . . . deb http://security.ubuntu.com/ubuntu xenial-security universe deb-src http://security.ubuntu.com/ubuntu xenial-security universe deb http://security.ubuntu.com/ubuntu xenial-security multiverse deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
Кроме того, вы можете использовать команду apt-cache для вывода списка всех репозиториев.
Эта команда также предоставит более подробную информацию о репозитории.
Давайте попробуем следующую команду:
Package files: 100 /var/lib/dpkg/status release a=now 500 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 Packages release v=16.04,o=LP-PPA-ondrej-php,a=xenial,n=xenial,l=***** The main PPA for supported PHP versions with many PECL extensions *****,c=main,b=amd64 origin ppa.launchpad.net 500 https://deb.nodesource.com/node_13.x xenial/main amd64 Packages release o=Node Source,n=xenial,l=Node Source,c=main,b=amd64 origin deb.nodesource.com . . . 500 http://mirrors.digitalocean.com/ubuntu xenial/main amd64 Packages release v=16.04,o=Ubuntu,a=xenial,n=xenial,l=Ubuntu,c=main,b=amd64 origin mirrors.digitalocean.com Pinned packages:
Заключение
В этом руководстве вы научились находить все репозитории, настроенные в системе на основе Ubuntu или Debian.