OS: CentOS 5.6
ip:eth0 192.168.1.17 netmask 255.255.255.0
Gateway: 192.168.1.1
kernel version: 2.6.18-238.19.1.el5
1. Install yum-utils
linuxdba --> yum install yum-utils
2. Create source repo
linuxdba --> touch /etc/yum.repo.d/source.repo
[source]
name=source
baseurl=http://mirrors.163.com/centos/5.6/os/SRPMS/
enable=1
[source_update]
name=source_update
baseurl=http://mirrors.163.com/centos/5.6/updates/SRPMS/
enable=1
3. Download the kernel source
linuxdba --> yumdownloader --source kernel
4. Install the kernel source
linuxdba --> mkdir /usr/src/redhat
linuxdba --> rpm -ivh kernel-2.6.18-238.19.1.el5.src.rpm
you could find the kernel source files at "/usr/src/redhat/SOURCE".
Or you could download mannally.
linuxdba --> wget http://mirrors.163.com/centos/5.6/updates/SRPMS/kernel-2.6.18-238.19.1.el5.src.rpm
linuxdba --> rpm -ivh kernel-2.6.18-238.19.1.el5.src.rpm