I’m searching for a credible way to disable repositories and stop them from updating my packages. I’ve had some issue and found some ways on the internet but wanted to hear an opinion what’s best
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello,
There are a couple of ways to do so, depending on what you want to achieve.
If you now the exact repository you want to deny you can simply run:
If you are not sure about the repo’s name, you can run:
From there get the repo id.
There are other ways but is is the quickest I believe.
If you’re using AlmaLinux 9, which is an RHEL fork like CentOS, the package manager in use is
dnf
(which replacedyum
in recent RHEL-based distributions).To disable a repository (or repositories) and stop them from updating your packages, you can follow these steps:
List Available Repositories
Disable a Repository
To disable a specific repository, you can use the
dnf config-manager
tool. If you don’t have it installed, install thednf-plugins-core
package:Now, to disable a repository, for instance
epel
, you would do:Replace
epel
with the name of the repository you wish to disable.Temporary Disable During a Transaction
If you just want to temporarily exclude a repository during a specific
dnf
transaction, you can use the--disablerepo
option. For example:Permanent Disable via Configuration Files
Repositories have their configuration files located in
/etc/yum.repos.d/
. To disable a repository, you can edit its respective configuration file and setenabled=0
.For example, to disable the
epel
repository:Find the section for the repository and set:
Hi @brendros,
Additionally, if you want to disable only a specific package from being updated, you can open and edit the yum.conf file, which is located in
/etc/yum.conf
or in/etc/yum/yum.conf
. In the file if there isn’t a line exclude add one that way:The above will disable all PHP packages from being updated.