Question

How to disable repository from updates in Linux CentOS

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


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Accepted Answer

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:

  1. yum --disablerepo=Repo-Name

If you are not sure about the repo’s name, you can run:

  1. yum repolist

From there get the repo id.

There are other ways but is is the quickest I believe.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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:

  1. exclude=php*

The above will disable all PHP packages from being updated.