Installing Centos 5.11 with 2.6.18-kernel
A note describing the process of installing Centos 5.11 with 2.6.18-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.18 kernel. The system described below is suitable for working with the 2.6.18 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 centos69.sentech.home 2.6.32-696.el6.i686 #1 SMP Tue Mar 21 18:53:30 UTC 2017 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
snapshot centos-kernel-sources
Install and Build the 2.6.18 Stock Kernel
start the vm
login as wsenn
gpg --keyserver pgp.surfnet.nl --recv-keys C4790F9D
mkdir ~/Downloads
cd ~/Downloads
wget http://cdn.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.tar.xz
wget http://cdn.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.tar.sign
mkdir ~/linux
cd ~/linux
cp ~/Downloads/linux-* .
unxz linux-2.6.18.tar.xz
gpg --verify linux-2.6.18.tar.sign linux-2.6.18.tar
...
gpg: Good signature from "Linux Kernel Archives Verification Key (One-off resigning of old releases) <ftpadmin@kernel.org>"
...
tar xvf linux-2.6.18.tar
cd linux-2.6.18
make clean && make mrproper
cp ~/rpmbuild/SOURCES/kernel-2.6.18-i686-PAE.config .
make oldconfig
take the 9 or so defaults (keep hitting enter)
time make -j8
Results on MacBook:
real 4m40.994s
user 14m32.233s
sys 2m43.542s
sudo make modules_install
sudo make install
ignoring:
WARNING: No module ahci found for kernel 2.6.18, continuing anyway
WARNING: No module ata_piix found for kernel 2.6.18, continuing anyway
WARNING: No module ahci found for kernel 2.6.18, continuing anyway
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.18 #1 SMP Sun Mar 4 19:17:33 CST 2018 i686 i686 i386 GNU/Linux
sudo vi /boot/grub/menu.lst
change to
default=0
sudo halt
snapshot running-2.6.18
Celebrate - you are ready to begin kernel hackery.
Export and save an appliance
post added 2022-12-01 16:55:00 -0600