How To Disable Specific Package Updates In RHEL/CentOS Linux

Datetime:2017-04-19 05:37:15         Topic: Centos          Share        Original >>
Here to See The Original Article!!!

We can exclude a list of packages from being installed or updating from all repositories by specifying that we want to exclude them in the yum.conf file.

This will prevent yum from updating these packages and all future updates will be ignored as we will see here.

To prevent a specific package from receiving updates, we simply edit the /etc/yum.conf file to make use of the ‘exclude’ option.

For example, on my CentOS 7 system I currently have an update available for the ‘epel-release’ package as shown below.

[[email protected]
~]# yum check-update epel-release

Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos.mirror.digitalpacific.com.au * epel: fedora.mirror.serversaustralia.com.au * extras: mirror.nsw.coloau.com.au * updates: centos.mirror.digitalpacific.com.au epel-release.noarch

Now let’s edit the /etc/yum.conf file to specifically exclude updates to this package.

[[email protected]
~]# cat /etc/yum.conf [main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=5 bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release exclude=epel-release

Note that this file is all default except for the ‘exclude’ option that I have added to the bottom of the file, specifying the package that I want to exclude. We can add multiple packages that we want to exclude from being updated by simply adding more afterwards separated by a space.

Now when I perform the same ‘yum check-update epel-release’ command there are no results shown, because the epel-release package has been excluded from the server and will therefore not be updated.

[[email protected]
~]# yum check-update epel-release

Loaded plugins: fastestmirror, langpacks base | 3.6 kB 00:00:00 epel/x86_64/metalink | 2.9 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 Loading mirror speeds from cached hostfile * base: mirror.nsw.coloau.com.au * epel: fedora.mirror.serversaustralia.com.au * extras: mirror.nsw.coloau.com.au * updates: mirror.nsw.coloau.com.au

While in this example we have excluded a package that is already installed from updating, we can also specify packages that we don’t want to install.

It’s important to keep in mind that doing this will also disable security updates for a package if it’s already installed as all future updates will be excluded which may not be ideal.

Summary

We have seen that by performing this simple modification to the /etc/yum.conf file we can easily prevent a specific package from being installed, disabling future updates for that package.








New