Command to disable/enable repo in AlmaLinux 8 or Rocky Linux

To install some third-party applications or packages, we add their repository on our Linux operating system. However, in case any of them is interfering or we don’t want to update some particular package available in some particular repository then we can disable the same but without removing it. Here in this tutorial, we will show how to disable or enable some repository on Almalinux 8 or Rocky Linux.

Run system update

Enable and disable of the repository can easily be handled by dnf config-manger tool that is available on the system by default, however, let’s run first the update command.

sudo dnf update

 

List all Repos

Let’s see what are the Repos so far available on our system. The below command not lists all system repositories but also their Repo IDs that we can use to enable or disable them.

dnf repolist

Output:

repo id                      repo name
appstream                AlmaLinux 8 - AppStream
baseos                   AlmaLinux 8 - BaseOS
epel                     Extra Packages for Enterprise Linux 8 - x86_64
epel-modular             Extra Packages for Enterprise Linux Modular 8 - x86_64
extras                   AlmaLinux 8 - Extras
pgAdmin4                 pgadmin4
pgdg10                   PostgreSQL 10 for RHEL/CentOS 8 - x86_64
pgdg11                   PostgreSQL 11 for RHEL/CentOS 8 - x86_64
pgdg13                   PostgreSQL 13 for RHEL/CentOS 8 - x86_64

Disable AlmaLinux/Rocky Repository

Now, check the “repo id” of the repository you want to disable on your AlmaLinux or Rocky 8 and use that with the below-given command:

dnf config-manager --disable repository-id

For example, If you want to disable the EPEL repo, then the command will be:

sudo dnf config-manager --disable epel

Enable or Disable repository in AlmaLinux or Rocky 8

Enable Repository

Now, after some time, if you want to enable the disabled repository, we can use the same tool with --enable option.

dnf config-manager --enable repository-id

Example: Now, to enable the EPEL repo again the command will be:

sudo dnf config-manager --enable epel

See: How to enable EPEL repository on AlmaLinux 8

 

Use to add the repo

In addition to the above two key tasks, we can also use config-manager to add repo on AlmaLinux or Rocky:

dnf config-manager --add-repo repository_url

 

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.