How to Enable and Disable Repositories in CentOS

CentOS repositories are collections of software packages that are stored in repositories and can be installed on your system via yum or dnf package managers.

What Are CentOS Repositories?

Hax GIF

Hax GIF

Use the command yum repolist or dnf repolist to list all currently enabled repositories in CentOS.

Check Available Repositories

Puppyhacker GIF

Puppyhacker GIF

To enable a specific repository, run: sudo yum-config-manager --enable <repository-name> or sudo dnf config-manager --enable <repository-name>.

Enable a Repository

Keyboard Thumbs GIF

Keyboard Thumbs GIF

To disable a repository, use the command: sudo yum-config-manager --disable <repository-name> or sudo dnf config-manager --disable <repository-name>.

Disable a Repository

More Of My Hacking GIF

More Of My Hacking GIF

You can enable or disable a repository for a single session using the --enablerepo or --disablerepo flag in your yum or dnf commands.

Enable/Disable Repositories Temporarily

Computer Hacker Fallout GIF

Computer Hacker Fallout GIF

Repository configurations are stored in /etc/yum.repos.d/. You can manually edit these .repo files to enable or disable repositories by changing the enabled=1 or enabled=0 values.

Managing Repository Files

Hacker Reality Colored Keyboard GIF

Hacker Reality Colored Keyboard GIF

Once you enable or disable a repository, verify the changes by running yum repolist or dnf repolist again to ensure your modifications have taken effect.

Verify Enabled Repositories

Thumbs Up Hacker GIF

Thumbs Up Hacker GIF