Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Add a Repository in Linux

In the Linux environment, a repository is a central location where software packages are stored and can be easily installed or updated. Adding a repository to your Linux system is important because it allows you to access a wide range of software packages that are not available in the default system repositories. By adding a repository, you can easily install and update software packages with just a few commands.

In Linux, there are different package managers depending on the distribution you are using. The most commonly used package managers are apt for Debian-based distributions (e.g., Ubuntu), yum/dnf for Red Hat-based distributions (e.g., CentOS, Fedora), and zypper for SUSE-based distributions (e.g., openSUSE). The commands and steps mentioned in this article may vary slightly depending on the package manager used in your Linux distribution.

Examples:

  1. Adding a Repository using apt (Debian-based distributions):

    • Open a terminal.
    • Update the package lists by running the following command:
      sudo apt update
    • Install the software-properties-common package, which provides the add-apt-repository command:
      sudo apt install software-properties-common
    • Add the repository using the add-apt-repository command. For example, to add the official Docker repository, run:
      sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    • Update the package lists again to include the newly added repository:
      sudo apt update
  2. Adding a Repository using yum (Red Hat-based distributions):

    • Open a terminal.
    • Install the yum-utils package, which provides the yum-config-manager command:
      sudo yum install yum-utils
    • Add the repository using the yum-config-manager command. For example, to add the EPEL repository, run:
      sudo yum-config-manager --add-repo=https://dl.fedoraproject.org/pub/epel/7/x86_64/
    • Enable the repository by running:
      sudo yum-config-manager --enable epel
    • Update the package lists:
      
      sudo yum update
  3. Adding a Repository using zypper (SUSE-based distributions):

    • Open a terminal.
    • Add the repository using the zypper command. For example, to add the Packman repository, run:
      sudo zypper addrepo -cfp 90 https://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Tumbleweed/ packman
    • Refresh the repository metadata:
      
      sudo zypper refresh

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.