Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
8.4.5. Adding, Enabling, and Disabling a Yum Repository
Section 8.4.2, “Setting [repository] Options” described various options you can use to define a Yum repository. This section explains how to add, enable, and disable a repository by using the
yum-config-manager command.
Important
When the system is registered with the certificate-based
Red Hat Network, the Red Hat Subscription Manager tools are used to manage repositories in the /etc/yum.repos.d/redhat.repo file. See Chapter 6, Registering the System and Managing Subscriptions for more information how to register a system with Red Hat Network and use the Red Hat Subscription Manager tools to manage subscriptions.
Adding a Yum Repository
To define a new repository, you can either add a
[repository] section to the /etc/yum.conf file, or to a .repo file in the /etc/yum.repos.d/ directory. All files with the .repo file extension in this directory are read by yum, and it is recommended to define your repositories here instead of in /etc/yum.conf.
Warning
Obtaining and installing software packages from unverified or untrusted software sources other than Red Hat Network constitutes a potential security risk, and could lead to security, stability, compatibility, and maintainability issues.
Yum repositories commonly provide their own
.repo file. To add such a repository to your system and enable it, run the following command as root:
yum-config-manager --add-repo repository_url
yum-config-manager --add-repo repository_url
where repository_url is a link to the
.repo file. For example, to add a repository located at http://www.example.com/example.repo, type the following at a shell prompt:
Enabling a Yum Repository
To enable a particular repository or repositories, type the following at a shell prompt as
root:
yum-config-manager --enable repository
yum-config-manager --enable repository
where repository is the unique repository ID (use
yum repolist all to list available repository IDs). Alternatively, you can use a glob expression to enable all matching repositories:
yum-config-manager --enable glob_expression
yum-config-manager --enable glob_expression
For example, to enable repositories defined in the
[example], [example-debuginfo], and [example-source]sections, type:
When successful, the
yum-config-manager --enable command displays the current repository configuration.
Disabling a Yum Repository
To disable a Yum repository, run the following command as
root:
yum-config-manager --disable repository
yum-config-manager --disable repository
where repository is the unique repository ID (use
yum repolist all to list available repository IDs). Similarly to yum-config-manager --enable, you can use a glob expression to disable all matching repositories at the same time:
yum-config-manager --disable glob_expression
yum-config-manager --disable glob_expression
When successful, the
yum-config-manager --disable command displays the current configuration.