### Starting from a Fresh CentOS 6.2 Linode ### Enable the native kernel to boot from pvgrub ### It will autoconfigure itself with each yum update. ### This is adapted from a previous script for CentOS 5.5 found here: ### http://library.linode.com/assets/542-centos5-native-kernel-selinux-enforcing.sh ### Provided via the linode wiki ### http://library.linode.com/linode-platform/custom-instances/pv-grub-howto#sph_centos-5 ### Provided without warranty, although since it should only be run ### on first box build if your box gets broken simply rebuild it mkdir /boot/grub/ DISTRO_PLATFORM=`uname -p` AWK_VERSION_MATCH="{if(\$1==\"kernel.$DISTRO_PLATFORM\") print \$2}" KERNEL_VERSION=`yum -q list kernel | awk "$AWK_VERSION_MATCH"` ### Write template grub.conf cat > /boot/grub/grub.conf << EOF # grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0) # kernel /boot/vmlinuz-version ro root=/dev/xvda # initrd /boot/initrd-version.img #boot=/dev/xvda default=0 timeout=3 title CentOS ($KERNEL_VERSION.$DISTRO_PLATFORM) root (hd0) kernel /boot/vmlinuz-$KERNEL_VERSION.$DISTRO_PLATFORM root=/dev/xvda initrd /boot/initrd-$KERNEL_VERSION.$DISTRO_PLATFORM.img EOF ln -s /boot/grub/grub.conf /boot/grub/menu.lst yum -y install kernel if [ $? -ne 0 ]; then echo "ERROR aborting..." exit 1 fi mkinitrd -f /boot/initrd-${KERNEL_VERSION}.${DISTRO_PLATFORM}.img $KERNEL_VERSION.$DISTRO_PLATFORM ### Make console work mount /dev/xvda /mnt mkdir /mnt/dev/pts umount /mnt