2018-01-21 13:48:48 +00:00
= Adding or removing software repositories in Fedora
2023-08-08 09:25:28 +00:00
Anthony McGlone
:revnumber: F37
:revdate: 2023-01-05
:category: Administration
2023-08-28 21:49:13 +00:00
:tags: How-to, DNF, Application, Software-Installation
2023-08-08 09:25:28 +00:00
//:page-aliases:
2017-12-18 16:23:48 +00:00
2023-08-08 09:25:28 +00:00
include::partial$attributes.adoc[]
[abstract]
2017-12-18 16:23:48 +00:00
This section describes how to add, enable, or disable a software repository with the DNF application.
2023-08-04 07:31:26 +00:00
== Adding repositories
This section describes how to add software repositories with the `dnf config-manager` command.
* To add a new repository, do the following as `*root*`.
. Define a new repository by adding a new file with the `.repo` suffix to the [filename]`/etc/yum.repos.d/` directory. For details about various options to use in the `.repo` file, see the xref:f{MAJOROSVER}@fedora:system-administrators-guide:package-management/DNF.adoc#sec-Setting_repository_Options[Setting [repository\] Options] section in the System Administrator's Guide
. Add the newly created repository.
+
[literal,subs="+quotes,attributes"]
----
dnf config-manager --add-repo `*_repository_*`
----
+
Where *_repository_* is the path to the created `.repo` file, for example:
+
----
2024-10-29 21:25:44 +00:00
dnf config-manager addrepo --from-repofile=/tmp/fedora_extras.repo
2023-08-04 07:31:26 +00:00
----
== Enabling repositories
This section shows how to enable a particular software repository by using the `dnf config-manager` command.
* To enable a particular repository, run the following command as `*root*`.
+
[literal,subs="+quotes,attributes"]
----
2024-10-29 21:25:44 +00:00
dnf config-manager setopt *_repository_*.enabled=1
2023-08-04 07:31:26 +00:00
----
+
Where *_repository_* is the unique repository ID, for example:
+
----
2024-10-29 21:25:44 +00:00
dnf config-manager setopt fedora-extras.enabled=1
2023-08-04 07:31:26 +00:00
----
== Disabling repositories
This section shows how to disable a particular software repository by using the `dnf config-manager` command.
* To disable a particular repository, run the following command as `*root*`.
+
[literal,subs="+quotes,attributes"]
----
2024-10-29 21:25:44 +00:00
dnf config-manager setopt *_repository_*.enabled=0
2023-08-04 07:31:26 +00:00
----
+
Where *_repository_* is the unique repository ID, for example:
+
----
2024-10-29 21:25:44 +00:00
dnf config-manager setopt fedora-extras.enabled=0
2023-08-04 07:31:26 +00:00
----
== Removing repositories
This section shows how to remove a Yum repository (or `.repo` file).
[NOTE]
====
If you know the ID of a repository, but you're not sure what `.repo` it belongs to,
you can run the following command [red]#`pass:[grep -E "^\[.*\]" /etc/yum.repos.d/*]`#.
This will print a list of the repository IDs that are associated with each Yum repository.
====
* To remove a Yum repository, run the following command as `*root*`.
+
[literal,subs="+quotes,attributes"]
----
rm /etc/yum.repos.d/*_file_name_*.repo
----
+
Where *_file_name_* is the name of the `.repo` file.
2017-12-18 16:23:48 +00:00
2022-11-23 15:00:25 +00:00