Showing posts with label Kernel. Show all posts
Showing posts with label Kernel. Show all posts

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

Thursday, May 30, 2013

[Solved] Unable to find a valid source directory. Please install the kernel headers for your operating system.

To fix the error " Unable to find a valid source directory. Please install the kernel headers for your operating system." Run the command below:
---------------------------------------------------------------
yum install kernel-header kernel-devel
---------------------------------------------------------------

SAMPLE OUTPUT:
-------------------------------------------------------------
 [~]# yum install kernel-header kernel-devel
Loaded plugins: fastestmirror, rhnplugin, security
Loading mirror speeds from cached hostfile
 * cloudlinux-x86_64-server-6: xmlrpc.cln.cloudlinux.com
Setting up Install Process
No package kernel-header available.
Resolving Dependencies
--> Running transaction check
---> Package kernel-devel.x86_64 0:2.6.32-379.22.1.lve1.2.17.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================
 Package                            Arch                         Version                                                 Repository                                        Size
================================================================================================================================================================================
Installing:
 kernel-devel                       x86_64                       2.6.32-379.22.1.lve1.2.17.1.el6                         cloudlinux-x86_64-server-6                       7.3 M

Transaction Summary
================================================================================================================================================================================
Install       1 Package(s)

Total download size: 7.3 M
Installed size: 0
Is this ok [y/N]: y
Downloading Packages:
kernel-devel-2.6.32-379.22.1.lve1.2.17.1.el6.x86_64.rpm                                                                                                  | 7.3 MB     00:00   
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : kernel-devel-2.6.32-379.22.1.lve1.2.17.1.el6.x86_64                                                                                                          1/1
  Verifying  : kernel-devel-2.6.32-379.22.1.lve1.2.17.1.el6.x86_64                                                                                                          1/1

Installed:
  kernel-devel.x86_64 0:2.6.32-379.22.1.lve1.2.17.1.el6                                                                                                                        
Complete!
------------------------------------------------------------- 

Twitter Delicious Facebook Digg Stumbleupon Favorites More

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