Installing Centos 5.11 with-2.6.17.8 kernel
A note describing the process of installing Centos 5.11 with the 2.6.17.8 kernel in order to be able to work along with Kroah-Hartman’s 2007 book, Linux Kernel in a Nutshell, in the modern era.
created 20180303.2024
Overview
The purpose of installing this system is to have a system capable of working through Kroah-Hartman’s 2007 book, Linux Kernel in a Nutshell. In the book, the author describes the 2.6.17.8 kernel. The system described below is suitable for working with the 2.6.17.8 kernel as described in Kroah-Hartman.
System information
MacBook Pro (15-inch, Mid 2012):
Processor 2.6 GHz Intel Core i7 - 4 cores
Memory 16 GB 1600 MHz DDR3
Mac OS High Sierra 10.13.3
Darwin giar 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
VirtualBox 5.2.8-121009
Guest OS:
Centos 5.11 32 bit
References
Kroah-Hartman, G. (2007). Linux Kernel in a Nutshell. Sebastopol, CA: O’Reilly Media, Inc.
Resources
I need the kernel source (2.6.18): https://web.archive.org/web/20080613161831/http://wiki.centos.org:80/HowTos/I_need_the_Kernel_Source
How To Compile A Kernel - The CentOS Way: https://www.howtoforge.com/kernel_compilation_centos
I need to build a custom kernel (2.6.18): https://web.archive.org/web/20080613161831/http://wiki.centos.org:80/HowTos/Custom_Kernel
Kernel/Configuration: https://web.archive.org/web/20190121022143/https://wiki.gentoo.org/wiki/Kernel/Configuration
Download and verify media, move to storage
mkdir ~/kroah-hartman
cd ~/kroah-hartman
curl -O https://ftp.iij.ad.jp/pub/linux/centos-vault/5.11/isos/i386/CentOS-5.11-i386-bin-DVD-1of2.iso
curl -O https://ftp.iij.ad.jp/pub/linux/centos-vault/5.11/isos/i386/sha256sum.txt.asc
curl -O https://ftp.iij.ad.jp/pub/linux/centos-vault/RPM-GPG-KEY-CentOS-5
gpg --import RPM-GPG-KEY-CentOS-5
gpg --verify sha256sum.txt.asc
...
gpg: Good signature from "CentOS-5 Key (CentOS 5 Official Signing Key) <centos-5-key@centos.org>" [expired]
...
cat sha256sum.txt.asc
...
4e67b34accc12ff6176b7ccbb3eeadcdd042f06d360d9cd940e0d77373724930 CentOS-5.11-i386-bin-1of8.iso
...
openssl sha256 CentOS-5.11-i386-bin-DVD-1of2.iso
SHA256(CentOS-5.11-i386-bin-1of8.iso)= 4e67b34accc12ff6176b7ccbb3eeadcdd042f06d360d9cd940e0d77373724930
mkdir -p ~/_workarea/_CD_DVD/_iso/centos/5.11
mv ./* ~/_workarea/_CD_DVD/_iso/centos/5.11/
cd
Create a Centos Instance in Virtual Box
Create a New VirtualBox VM Instance
Name: centos511
Version: Red Hat (32-bit)
Memory: 4096MB
HDD: 20GB
System-Motherboard-Extended Features-Enable I/O APIC
System-Processor-Processors 4
Storage Devices
Remove Controller: SATA
Add Existing Hard Disk to Controller:IDE
Add iso to Empty CD
Network Advanced - Port Forwarding - SSH 3335 22
Install in the VM
Boot VM
Press Enter to Install or upgrade an existing system
Press Enter twice to Test the media
Press Enter to accept success :)
Reattach the iso (it has been ejected)
Press Enter to continue
Press Tab to select Continue and Press Enter
Click Next in the Graphic Installer to begin the Graphical Installation Process
Click Next to accept English as the Installer Language
Click Next to accept US English as the keyboard mapping
Click Yes to initialize sda
Click Next to allow partitioning
Click Yes to remove all partitions
Enter centos511.sentech.home as the Hostname and then click Next
Choose America/Chicago and Click Next
Enter and confirm a root password and click Next
Deselect Gnome and Select Sever, click Customize now, and Click Next
Deselect all packages in all categories except for the Base Package Click Next
Click Next to begin the install
Click Reboot
Eject the iso and halt
snapshot installed in vbox
Create a user with wheel privileges
start VM
Pass on Setup screen
adduser -m -G wheel wsenn
passwd wsenn
visudo
uncomment wheel login
halt
snapshot baseline
Make VM headless and prep for ssh from host
VBoxManage list vms
...
"centos511" {someuuid}
...
VBoxManage modifyvm "centos511" --defaultfrontend headless
start VM
from host
ssh-copy-id localhost -p 3335
Update Centos
start VM
ssh localhost -p 3335
uname -a
Linux centos511.sentech.home 2.6.18-398.el5PAE #1 SMP Tue Sep 16 21:31:44 EDT 2014 i686 i686 i386 GNU/Linux
sudo -s
cat > /etc/yum.repos.d/CentOS-Base.repo <<EOF
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://vault.centos.org/5.11/os/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=http://vault.centos.org/5.11/updates/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=http://vault.centos.org/5.11/extras/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=http://vault.centos.org/5.11/centosplus/i386/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
baseurl=http://vault.centos.org/5.11/contrib/i386/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
EOF
exit
sudo yum update
1 install, 43 upgrade, 83MB
sudo halt
snapshot updated
Install the developer tools
Start the VM back up
uname -a
Linux centos511.sentech.home 2.6.18-419.el5PAE #1 SMP Fri Feb 24 22:09:08 UTC 2017 i686 i686 i386 GNU/Linux
sudo yum groupinstall 'Development Tools'
111 install, 92MB
sudo yum install audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel ncurses-devel newt-devel python-devel xmlto zlib-devel
33 install, 71MB
sudo halt
snapshot devtools
start VM
find the current source https://ftp.iij.ad.jp/pub/linux/centos-vault/5.11/updates/SRPMS/
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
wget https://ftp.iij.ad.jp/pub/linux/centos-vault/5.11/updates/SRPMS/kernel-2.6.18-419.el5.src.rpm
rpm -ivh kernel-2.6.18-419.el5.src.rpm
This can take a few minutes depending on the download speed
cd ~/rpmbuild/SPECS
rpmbuild -bp --target=$(uname -m) kernel.spec
ls ~/rpmbuild/BUILD/kernel*/linux*/
sudo halt
snap centos-kernel-sources
Install and Build the 2.6.17.8 Stock Kernel
start VM
mkdir ~/Downloads
on the host
gpg --keyserver pgp.surfnet.nl --recv-keys C4790F9D
gpg --keyserver pgp.surfnet.nl --recv-keys C86BA06A517D0F0E
mkdir -p ~/_workarea/_CD_DVD/_iso/centos/5.11/kernel
cd ~/_workarea/_CD_DVD/_iso/centos/5.11/kernel
wget https://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.17.tar.gz
wget https://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.17.tar.sign
wget https://web.archive.org/web/20110810160204/http://www.kernel.org:80/pub/linux/kernel/v2.6/patch-2.6.17.8.gz
wget https://web.archive.org/web/20110810160204/http://www.kernel.org:80/pub/linux/kernel/v2.6/patch-2.6.17.8.sign
wget https://web.archive.org/web/20110810135240/http://www.kernel.org:80/pub/linux/kernel/v2.6/incr/patch-2.6.17.8-9.gz
wget https://web.archive.org/web/20110810135240/http://www.kernel.org:80/pub/linux/kernel/v2.6/incr/patch-2.6.17.8-9.sign
mkdir test
cd test
cp ../* .
for f in *gz; do gzip -d $f; done
gpg --verify linux-2.6.17.tar.sign linux-2.6.17.tar
gpg --verify patch-2.6.17.8.sign patch-2.6.17.8
gpg --verify patch-2.6.17.8-9.sign patch-2.6.17.8-9
...
gpg: Good signature from "Linux Kernel Archives Verification Key (One-off resign
ing of old releases) <ftpadmin@kernel.org>" [unknown]
...
... for the patches, unfortunately, I couldn't locate patches with the new key, but gonna move ahead like it worked ...
gpg: Good signature from "Linux Kernel Archives Verification Key <ftpadmin@kernel.org>" [unknown]
gpg: WARNING: This key has been revoked by its owner!
...
cd ~/_workarea/_CD_DVD/_iso/centos/5.11/kernel/test
scp -P 3335 ./* localhost:Downloads
on the guest:
gpg --keyserver pgp.surfnet.nl --recv-keys C4790F9D
gpg --keyserver pgp.surfnet.nl --recv-keys C86BA06A517D0F0E
mkdir ~/linux
cd ~/linux
cp ~/Downloads/* .
gpg --verify linux-2.6.17.tar.sign linux-2.6.17.tar
gpg --verify patch-2.6.17.8.sign patch-2.6.17.8
gpg --verify patch-2.6.17.8-9.sign patch-2.6.17.8-9
tar xvf linux-2.6.17.tar
cd linux-2.6.17
patch -p1 < ../patch-2.6.17.8
head -n 5 Makefile
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 17
EXTRAVERSION = .8
NAME=Crazed Snow-Weasel
if you want to go to 2.6.17.9:
patch -p1 < ../patch-2.6.17.8-9
should be no errors
head -n 5 Makefile
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 17
EXTRAVERSION = .9
NAME=Crazed Snow-Weasel
cd ..
mv linux-2.6.17 linux-2.6.17.8
cd linux-2.6.17.8
make clean && make mrproper
cp /usr/src/kernels/2.6.18-419.el5-i686/.config .
make menuconfig
/
to search IKCONFIG
in General Setup
/
to search again SATA
In Device Drivers->SCSI device support->SCSI device support (SCSI [=m])->SCSI low-level drivers->Serial ATA (SATA) support (SCSI_SATA [=n])
Select the settings:
- Kernel .config support
- Enable access to .config through /proc/config.gz
M Serial ATA (SATA) support
M AHCI SATA support
M Intel PIIX/ICH SATA support
Save and Exit menuconfig
make oldconfig
take the defaults (keep hitting enter)
time make -j8
Results on MacBook:
real 4m11.244s
user 12m44.299s
sys 2m23.462s
sudo make modules_install
sudo make install
sudo reboot
(make sure you’re seeing the console as you will need to select the kernel to boot from - click Show in VirtualBox while booting)
uname -a
Linux centos511.sentech.home 2.6.17.8 #1 SMP Wed Mar 7 00:19:57 MST 2018 i686 i686 i386 GNU/Linux
cp /proc/config.gz .
gunzip config.gz
diff config linux/linux-2.6.17.8/.config
sudo vi /boot/grub/menu.lst
change to
default=0
sudo halt
snapshot running-2.6.17.8
Celebrate - you are ready to begin kernel hackery.
Export and save an appliance
post added 2022-12-01 15:01:00 -0600