How To Install/Compile Latest Kernel On CentOS 6

Installing a latest kernel onto your system, will help in supporting more hardware devices and for bug fixes that are there in the current kernel.

To install the kernel first download the latest stable kernel package from the following website. 
http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.4.7.tar.bz2   

Note: At the time of writing this article, this is the latest and stable package available, please make sure you download the latest stable version by visiting this website http://www.kernel.org

Install the dependency packages that are needed to compile the kernel.
[root@server ~] # yum install gcc ncurses-devel -y

Copy the downloaded kernel source package to the /usr/src directory
[root@server ~] # cd Downloads
[root@server Downloads] # cp linux-3.4.7.tar.bz2  /usr/src

Extract the downloaded package
[root@server ~] # cd /usr/src
[root@server src] # tar -xvjf linux-3.4.7.tar.bz2
[root@server src] # cd linux-3.4.7
 
Configure the kernel package
[root@server linux-3.4.7] # make oldconfig   

Note: It will make sure that your old configuration will still be available

Compile the kernel package
[root@server linux-3.4.7] # make     

Note: Running this command will take a long time to compile modules and drivers etc. Depending on the speed of your system, it may take more that an hour, be patient.

Install the kernel package and modules
[root@server linux-3.4.7] # make modules_install install

Note: This command will automatically create the following files in /boot directory.
System.map-3.4.7
vmlinuz-3.4.7
initramfs-3.4.7.img
Also it will make an entry in the grub.conf regarding the new kernel information.

Make sure to the system will boot with the newly installed kernel as default one.
[root@server linux-3.4.7] # vim /etc/grub.conf
default=0 

Reboot the system and check the kernel version
[root@server ~] # uname -r
3.4.7

Incase there is any problem, you can always revert back to the old kernel.

Post a Comment

Mới hơn Cũ hơn