Wednesday, April 6, 2011

How to upgrade kernel in Linux CentOS

Here's is the guide for you all to update kernel in Linux..especially in Centos...

Why the need for upgrading Kernel..might be your existing kernel crashes periodically...or the update you need would not be available in the current Linux version....However if we get a situation to upgrade Linux kernel...do the following...

The most important thing is if you update the kernel..it will automatically update some of the packages like httpd, MySQL. If you want to exclude these changes modify the file,

/etc/yum.conf 
as 
[main]
exclude=courier* apache* mod_ssl* httpd* perl mysql* php* spamassassin* exim*
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=centos-release
tolerant=1
exactarch=1
retries=20
obsoletes=1
gpgcheck=1

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

First you need to check the current version of  Kernel..type the below command in the prompt

uname -a

Most of the admin uses "yum upgrade kernel" to update the Kernel version..

yum upgrade kernel

Nothing to do.

the newer kernel version is not present in the Repo you are curretly using, you need to find out the corresponding  repo for the needed kernel...

here...we are going to upgrade the kernel from,


kernel-2.6.18-32  to kernel-2.6.18-238.5.1.1

but that kernel version was not found in the default repo....
so we need to find a exact one...
for this version I have found one which is given below...

Create a new file called centalt.repo file in /etc/yum.repos.d/ and paste the below 
contents.....

[CentALT]
name=CentALT Packages for Enterprise Linux 5 - $basearch
baseurl=http://centos.alt.ru/repository/centos/5/$basearch/
enabled=1
gpgcheck=0

Then try 

yum update kernel*

It will automatically add a new entry in grub.conf file....so just reboot the server and check..

uname -a

Kernel version is Updated ! ! ! !

No comments:

Post a Comment