Monday, November 11, 2013

Kernel compile with Grsec module in CentOS 6

Linux kernel is the life force of all Linux family of operating systems including Ubuntu, CentOS, and Fedora.
For most part, you don’t need to compile the kernel, as it is installed by default when you install the OS. Also, when there is a critical update done to the kernel, you can use yum, or apt-get to update the kernel on your Linux system.
However you might encounter certain situation, where you may have to compile kernel from source. The following are few situation where you may have to compile Kernel on your Linux system.
To enable experimental features that are not part of the default kernel.
To enable support for a new hardware that is not currently supported by the default kernel.
To debug the kernel
Or, just to learn how kernel works, you might want to explore the kernel source code, and compile it on your own.

(1) Download the kernel source
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.52.tar.bz2
tar xjf linux-3.2.52.tar.bz2
(2)Copy the config file from /boot
cp /boot/config-`uname -r` .config
(3) Download grsecurity patch
wget http://mirrors.muarf.org/grsecurity/stable/grsecurity-2.9.1-3.2.52-201311071633.patch.gz
gunzip grsecurity-2.9.1-3.2.52-201311071633.patch.gz
cd linux-3.2.52
(4) installed the patch
patch -p1
cd ../
mv linux-3.2.52 linux-3.2.52-grsec
cd linux-3.2.52-grsec
(5) Configured the new kernel with grsecurity 
make menuconfig
make bzImage && make modules
make modules_install && make install
(6) Verify the file /etc/grub.conf  for new kernel and boot proirity
(7) Disable selinux
cat /etc/selinux/config 
ip a
(7)Reboot the server two newly installed kernel
reboot
(8) Verify the kernel once the server is back online.
uname -r

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews