วันพฤหัสบดีที่ 10 กุมภาพันธ์ พ.ศ. 2554

How to force yum update command to Exclude certain packages

On CentOS yum uses a configuration file at /etc/yum.conf. If you need to place exclude directive to define list of packages to exclude from updates or install. You can follow up as below:

nano -w /etc/yum.conf

and add line:
exclude=kernel*

It should look like as follows:

[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
exclude=kernel*

# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h

# Default.
# installonly_limit = 3

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

And we can skip yum command updates on command line using as below:

#yum --exclude=kernel* update