• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

Disable Certain Package Updates using YUM in RHEL / CentOS / Fedora

How VPS by How VPS
November 2, 2018
in Linux
0
0
SHARES
40
VIEWS
Share on FacebookShare on Twitter

Contents

  1. How to Exclude Packages in YUM
    1. Sample Output
  2. How to Exclude Packages from EPEL Repo
    1. Sample Output

YUM (Yellowdog Updater Modified) is an open source default package management system for several Linux flavors like RHEL (Red Hat Enterprise Linux), CentOS (Community Enterprise Operating System)and Fedora. The YUM utility is used install, upgrade, remove rpm based packages from the distribution repositories in systems.

But sometime we don’t want to do update certain packages such as Apache Server (HTTP), MySQL, PHP and other major applications, because if such updates may harm currently running web application on server or you may stop updates till the application gets patched with new updates.

Disable Certain Package Updates using YUM in RHEL / CentOS / Fedora

YUM Exclude Package Updates


In this article we will show you how we can exclude (disable) certain package updates using YUMtool. We can exclude or disable certain package updates from the any third party repositories. The exclude syntax would be as follow.

exclude=package package1 packages*

The above syntax will exclude “package“, “package1” and list of “package” updates or installs. Each keyword should be separated with space for exclusion of packages.

How to Exclude Packages in YUM

To exclude (disable) specific package updates, Open file called /etc/yum.conf with your choice of editor.

# vi /etc/yum.conf

Add the following line at the bottom of the file with exclude keyword as shown below.

[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=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

# This is the default, if you make this bigger yum won't see if the metadata 
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

## Exclude following Packages Updates ##
exclude=httpd php mysql

In the above example, the line exclude will disable updates for “httpd” “php” and “mysql” packages. Let’s try installing or updating one of them using YUM command as shown below.

# yum update httpd
Sample Output
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.01link.hk
 * extras: centos.01link.hk
 * updates: mirrors.hns.net.in
base                                                   | 3.7 kB     00:00
extras                                                 | 3.0 kB     00:00
updates                                                | 3.5 kB     00:00
updates/primary_db                                     | 2.7 MB     00:16
Setting up Update Process
No Packages marked for Update

How to Exclude Packages from EPEL Repo

To exclude packages installs or updates from EPEL repository, then open the file called /etc/yum.repos.d/epel.repo.

# vi /etc/yum.repos.d/epel.repo

Add the exclude line by specifying packages to be exclude from the updates.

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
## Exclude following Packages Updates ##
exclude=perl php python

Now try to update above specified files from the EPEL repository using YUM command.

# yum --enablerepo=epel update perl php python
Sample Output
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.hns.net.in
 * epel: ftp.kddilabs.jp
 * extras: mirrors.hns.net.in
 * updates: mirrors.hns.net.in
Setting up Update Process
No Packages marked for Update

You can also use yum command line option to exclude package without adding to the repository files.

# yum --exclude=httpd update

To exclude list of packages, use the command as follows.

# yum --exclude=mysql/* --exclude=httpd/* update

This way you can exclude updates for any packages you want. There are many other ways you can do, for example, recently we’ve compiled a article on 4 useful ways to block/disable or lock certain packages using yum command in Linux, you should read this here:

4 Ways to Disable Certain Package Updates with Yum Command

Source: tecmint.com

Tags: Linux Commandslinux guidelinux vps setup guide
Previous Post

How to Make File and Directory Undeletable, Even By Root in Linux

Next Post

10 ‘free’ Commands to Check Memory Usage in Linux

Next Post

10 ‘free’ Commands to Check Memory Usage in Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet