CentOS Kernel Source Install
Mar 12th, 2012 | Comments
CentOS Kernel Source install, first off if you is just trying to build something or compile a tool on CentOS the n probably only need to install the Kernel-devel package if you is running a standard install you can install the Ker Nel-devel package on CentOS 6 with:
The above command would probably fix any compile issues you have that ask for kernel source, if it does don't please re Ad on.
On CentOS 6 There was only one kernel-devel package for both architectures x86_64 and i386 however on CentOS 5 there be th REE versions, if you is unsure on what version of you should install then run the command uname-r which would displ Ay your kernel version need to match the kernel version of you is running with the correct Kernel-devel package Bel ow
CentOS 5 Install Kernel-devel for i386 & x86_64:
Centos 5 Install Xen kernel-devel for x86_64 & i386:
yum install kernel-xen-devel
|
And finally to the install Kerenl-devel for PAE:
yum install kernel-pae-devel
|
CentOS Kernel Source Install (full) for CentOS 5 & 6
If Install kernel-devel above does not work or you require the full CentOS kernel source for another reason can instal L It on CentOS 5 & 6 with:
yum install rpm-build redhat-rpm-config unifdef
|
As a none root user run the following:
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}echo ‘%_topdir %(echo $HOME)/rpmbuild‘ > ~/.rpmmacros
|
To install the CentOS 6 kernel source
The following command would install the kernel source for CentOS 6.2, you can install it for other version of CentOS 6 Simp Ly by using the URL for the alternative version.
rpm -i http://vault.centos.org/6.2/updates/Source/SPackages/kernel-2.6.32-220.7.1.el6.src.rpm 2>&1 | grep -v mockb
|
How to install the CentOS 5.8 kernel source
The following would install the full kernel source on the CentOS 5.8, again the same applies–you can install the kernel SOURC E for another version of CentOS 5 by swapping the URL.
rpm -i http://vault.centos.org/5.8/updates/SRPMS/kernel-2.6.18-308.1.1.el5.src.rpm 2>&1 | grep -v mockb
|
When you have the correct kernel source RPM installed, run the following:
And then unpack the kernel source with:
rpmbuild -bp --target=`uname -m` kernel-2.6.spec 2> prep-err.log | tee prep-out.log
|
Make sure copy and paste the commands above as the UNAME-M command would pull your kernel arch (e.g x86_64) and prep T He source for your kernel, you can find the kernel source in your home dir in a directory called Rpmbuild/build/to access The CentOS kernel source install dir Type the following as the logged in user-built the kernel source with ~/RPMB uild/build/
CentOS Source Install