How to change custom CentOS kernel to stock CentOS kernel

First, install the stock Centos kernel via yum. Write down the version it installs!


yum install kernel

Check in /boot if the files are there:


ls -al /boot

You should see "vmlinuz-2.6.32-279.19.1.el6.x86_64" and "initramfs-2.6.32-279.19.1.el6.x86_64.img"

Then, check your root partition, and write it down. Look for "/", and write down the filesystem (/dev/md1 in this example)
df
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 20317384 997168 18296272 6% /
devtmpfs 16445824 192 16445632 1% /dev
tmpfs 16455248 0 16455248 0% /dev/shm
/dev/md1 20317384 997168 18296272 6% /
/dev/md2 95452964 192336 90450036 1% /home
/dev/md1 20317384 997168 18296272 6% /var/named/chroot/etc/named
/dev/md1 20317384 997168 18296272 6% /var/named/chroot/var/named
/dev/md1 20317384 997168 18296272 6% /var/named/chroot/etc/named.conf
/dev/md1 20317384 997168 18296272 6% /var/named/chroot/etc/named.rfc1912.zones
/dev/md1 20317384 997168 18296272 6% /var/named/chroot/etc/rndc.key
/dev/md1 20317384 997168 18296272 6% /var/named/chroot/usr/lib64/bind
/dev/md1 20317384 997168 18296272 6% /var/named/chroot/etc/named.iscdlv.key
/dev/md1 20317384 997168 18296272 6% /var/named/chroot/etc/named.root.key

Then edit "/boot/grub/grub.conf". Comment out or remove everything you see or make a backup:


cp /boot/grub/grub.conf /boot/grub/grub.conf.bk

Replace grub.conf with this


nano /boot/grub/grub.conf

default 0
timeout 5
title Centos Install (PXE)
root (hd0,0)
kernel /boot/vmlinuz-2.6.32-279.19.1.el6.x86_64 root=/dev/md1
initrd /boot/initramfs-2.6.32-279.19.1.el6.x86_64.img

Make a symbolic link from menu.lst to grug.conf as it is in stock CentOS, if it is not currently:

cd /boot/grub
mv menu.lst menu.lst.bk
ln -s ./grub.conf menu.lst

Cross your fingers and type:


reboot

Your server should be up in a few minutes. Once you logged in, check your kernel:


uname -a

You should see your newly installed kernel:

uname -a
Linux euro.drupion.net 2.6.32-279.19.1.el6.x86_64 #1 SMP Wed Dec 19 07:05:20 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

Congratulations, you just installed a stock kernel on your server!

Tags:

Add new comment

Filtered HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.