View Single Post
  #1  
Old 03-25-2006, 12:13 AM
Soulwatcher's Avatar
Soulwatcher Soulwatcher is offline
Senior Member
GB GEEK
 
Join Date: Feb 2006
Posts: 309
Send a message via MSN to Soulwatcher
Default Compiling kernel 2.6.14.6 with grsec Centos 4.2

Warning use this guide at your own risk! It works on my server it doesn't mean it will work on yours.

you need gcc to compile kernel.
Code:
yum install gcc
ncurses-devel package is needed while compiling kernel
Code:
yum install ncurses-devel
I like to build my kernels in /usr/local/src
Code:
CD /usr/local/src
down Load kernel 2.6.14.6
Code:
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.14.6.tar.gz
untar the kernel
Code:
tar -zxf linux-2.6.14.6.tar.gz
download the grsecurity patch
Code:
wget http://grsecurity.net/grsecurity-2.1.8-2.6.14.6-200601211647.patch.gz
patch the kernel
Code:
gunzip < grsecurity-2.1.8-2.6.14.6-200601211647.patch.gz | patch -p0
cd to the kernel
Code:
cd linux-2.6.14.6
clean your kernel source configuration etc
Code:
make clean && make mrproper
use your current configuration to configure your new kernel
Code:
cp /boot/config-`uname -r` .config
go into into the menu
Code:
make menuconfig
go to the grsecsecurity option select medium

now to actually compile the kernel
Code:
make bzImage
Code:
make modules
Code:
make modules_install
make sure there are *NO* errors after this! If you do get errors the below is not going to work.

copy the new files into your /boot directory.
Code:
cp .config /boot/config-2.6.14.6-grsec
cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.14.6-grsec
cp System.map /boot/System.map-2.6.14.6-grsec
mkinitrd /boot/initrd-2.6.14.6-grsec.img 2.6.14.6-grsec
using your favorite editor edit the grub config file.
Code:
/boot/grub/grub.conf
add the following line
Code:
title CentOS (2.6.14.6-grsec)
	root (hd0,0)
	kernel /vmlinuz-2.6.14.6-grsec ro root=LABEL=/
	initrd /initrd-2.6.14.6-grsec.img
Edit: make sure you check the root=LABEL=/ in grub as it may be different than mine. Make sure you use your servers own root=LABEL=/

thats it your done save and exit.
Reply With Quote