Requirements
To ease the installation I have created a base which can assist you with installing. It contains the files you need as images (formatted as Ext3). It is available as centos52-base.rar [dropbox] (35kb).
This file contains what is needed to install the CentOS 5.2 image for
use with coLinux:
- system.img 4Gb system image, formatted as Ext3
- swap512m.img 512Mb swap location
- Batch and parameters file needed to start coLinux
install.bat, install.txt for the installation process (needed once)
run.bat, run.txt to start the environment after install - instructions.txt file containing the commands to perform
Extract the base archive and place the CentOS 5.2 (i386) installation media in the same directory. Mirrors are provided on the download page of CentOS. If you do not want to download the DVD file, you can also choose to only download CD 1of6. For this you need to change the install.txt parameters file. After the initial install, you can then rely on YUM to install all additional packages.
I used a custom init ramdisk to create the images and perform the installation. Since this file is still rough, I suggest you to download this business card iso from debian. The businesscard ISO is about 35Mb.
With a tool like winrar (or mount it using a tool like Daemon Tools), you can extract the file /install.386/initrd.gz. If you prefer to only download the initrd.gz. Save this file as install_initrd.gz in the directory where you extracted this base directory. This ramdisk will be used to start a system to perform commands from which will start the RPM install.

After installing coLinux to the standard location you can run the install.bat and start the installation process. It will start the start kernel with the install_initrd.gz as ramdisk. The terminal of choice for this process was a NT terminal, since copy-n-paste was easier to perform. When the installation process interface is shown, you should toggle with ALT+F2 to a console.
Please press Enter to activate this console.

When you do so, you will see a BusyBox prompt where you can perform the instructions as shown in the instructions.txt.
Instructions
You will now perform the instructions needed to do the actual install. We will create a basic environment to perform an RPM installation of the base packages. After this you can use YUM to download and/or install additional packages. To create
the basic layout:
mkswap /dev/cobd7
swapon /dev/cobd7
mkdir /mnt/linux
mkdir /mnt/win
mkdir /mnt/stage2
mount /dev/cobd0 /mnt/linux
mkdir -p /mnt/linux/media/cdrom
mount -t cofs cofs0 /mnt/win
mount /dev/cobd1 /mnt/linux/media/cdrom
This will create some swapspace, a mountpoint /mnt/linux which points to the block device cobd0 (system.img), /mnt/win will be used to point to the coLinux program files folder and /mnt/stage2 will later be used to mount the CentOS stage2 image file. Block device cobd1 is used to mount the DVD image to the mountpoint /mnt/linux/media/cdrom. This will later be used to install the base packages from.
The stage2 image file uses the squashfs filesystem. CoLinux provides kernel modules to use this filesystem.
tar xzvf /mnt/win/vmlinux-modules.tar.gz lib/modules/2.6.22.18-co-0.7.3/kernel/fs/squashfs/squashfs.ko
insmod /lib/modules/2.6.22.18-co-0.7.3/kernel/fs/squashfs/squashfs.ko
mount -t squashfs -o loop /mnt/linux/media/cdrom/images/stage2.img /mnt/stage2
The contents then need to be copied to the /mnt/linux to form the basis of our installation process.
cp -a /mnt/stage2/ /mnt/linux
umount /mnt/stage2
mv /mnt/linux/stage2 /mnt/linux/base
This might take some time...
The system needs to have some directories which will form the basis. The following command will create this.
for n in bin dev proc lib usr tmp etc
do
mkdir -p /mnt/linux/$n
done
touch /mnt/linux/etc/fstab /mnt/linux/etc/mtab
mkdir -p /mnt/linux/var/lib/rpm
The location /var/lib/rpm is needed to store the RPM database files.
Pre-installation
RPM will need some libraries to run. These will be copied to the appropriate location using the following commands:
cd /mnt/linux/lib
ln -s ../base/lib/* .
rm /mnt/linux/lib/udev
rm /mnt/linux/lib/bdevid
mkdir /mnt/linux/usr/lib
cp -a /mnt/linux/base/usr/lib/librpm-* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/librpmio-* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/librpmdb-* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libpopt.* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libsqlite3.* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libelf* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libbeecrypt.* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libz.* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libbz2.* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/libstdc++.* /mnt/linux/usr/lib/
cp -a /mnt/linux/base/usr/lib/rpm /mnt/linux/usr/lib/
All necessary libraries are now available to pivot the root to the /mnt/linux location.
chroot /mnt/linux /base/usr/bin/sh
/base/usr/bin/rpm --initdb
This will create a fresh RPM database which the installation process can use.
Installation
You are now ready to perform the installation.
cd /media/cdrom/CentOS
/base/usr/bin/rpm -ivh setup-*.rpm
The following packages need to be installed at once. These will form a base installation of CentOS.
/base/usr/bin/rpm -ivh \
audit-libs-[0-9]*.rpm \
audit-libs-python-[0-9]*.rpm \
authconfig-[0-9]*.rpm \
basesystem-[0-9]*.rpm \
bash-[0-9]*.rpm \
beecrypt-[0-9]*.rpm \
bzip2-libs-[0-9]*.rpm \
centos-release-[0-9]*.rpm \
centos-release-notes-[0-9]*.rpm \
checkpolicy-[0-9]*.rpm \
chkconfig-[0-9]*.rpm \
coreutils-[0-9]*.rpm \
cpio-[0-9]*.rpm \
cracklib-[0-9]*.rpm \
cracklib-dicts-[0-9]*.rpm \
cryptsetup-luks-[0-9]*.rpm \
cyrus-sasl-lib-[0-9]*.rpm \
db4-[0-9]*.rpm \
dbus-[0-9]*.rpm \
dbus-glib-[0-9]*.rpm \
device-mapper-[0-9]*.rpm \
device-mapper-event-[0-9]*.rpm \
device-mapper-multipath-[0-9]*.rpm \
dhclient-[0-9]*.rpm \
dhcpv6-client-[0-9]*.rpm \
diffutils-[0-9]*.rpm \
dmidecode-[0-9]*.rpm \
dmraid-[0-9]*.rpm \
e2fsprogs-[0-9]*.rpm \
e2fsprogs-libs-[0-9]*.rpm \
ecryptfs-utils-[0-9]*.rpm \
ed-[0-9]*.rpm \
elfutils-libelf-[0-9]*.rpm \
ethtool-[0-9]*.rpm \
expat-[0-9]*.rpm \
file-[0-9]*.rpm \
filesystem-[0-9]*.rpm \
findutils-[0-9]*.rpm \
gawk-[0-9]*.rpm \
gdbm-[0-9]*.rpm \
glib2-[0-9]*.rpm \
glibc-[0-9]*.i686.rpm \
glibc-common-[0-9]*.rpm \
gnu-efi-[0-9]*.rpm \
grep-[0-9]*.rpm \
grub-[0-9]*.rpm \
gzip-[0-9]*.rpm \
hal-[0-9]*.rpm \
hdparm-[0-9]*.rpm \
hwdata-[0-9]*.rpm \
info-[0-9]*.rpm \
initscripts-[0-9]*.rpm \
iproute-[0-9]*.rpm \
iptables-[0-9]*.rpm \
iptables-ipv6-[0-9]*.rpm \
iputils-[0-9]*.rpm \
kbd-[0-9]*.rpm \
kernel-[0-9]*.rpm \
keyutils-libs-[0-9]*.rpm \
kpartx-[0-9]*.rpm \
krb5-libs-[0-9]*.rpm \
kudzu-[0-9]*.rpm \
less-[0-9]*.rpm \
libacl-[0-9]*.rpm \
libattr-[0-9]*.rpm \
libcap-[0-9]*.rpm \
libgcc-[0-9]*.rpm \
libgcrypt-[0-9]*.rpm \
libgpg-error-[0-9]*.rpm \
libhugetlbfs-[0-9]*.rpm \
libselinux-[0-9]*.rpm \
libselinux-python-[0-9]*.rpm \
libsemanage-[0-9]*.rpm \
libsepol-[0-9]*.rpm \
libstdc++-[0-9]*.rpm \
libsysfs-[0-9]*.rpm \
libtermcap-[0-9]*.rpm \
libusb-[0-9]*.rpm \
libuser-[0-9]*.rpm \
libvolume_id-[0-9]*.rpm \
libxml2-[0-9]*.rpm \
libxml2-python-[0-9]*.rpm \
lvm2-[0-9]*.rpm \
m2crypto-[0-9]*.rpm \
MAKEDEV-[0-9]*.rpm \
mcstrans-[0-9]*.rpm \
mingetty-[0-9]*.rpm \
mkinitrd-[0-9]*.rpm \
mktemp-[0-9]*.rpm \
module-init-tools-[0-9]*.rpm \
nash-[0-9]*.rpm \
ncurses-[0-9]*.rpm \
net-tools-[0-9]*.rpm \
newt-[0-9]*.rpm \
nspr-[0-9]*.rpm \
nss-[0-9]*.rpm \
openldap-[0-9]*.rpm \
openssh-[0-9]*.rpm \
openssh-clients-[0-9]*.rpm \
openssh-server-[0-9]*.rpm \
openssl-[0-9]*.i686.rpm \
pam-[0-9]*.rpm \
passwd-[0-9]*.rpm \
pciutils-[0-9]*.rpm \
pcre-[0-9]*.rpm \
pm-utils-[0-9]*.rpm \
policycoreutils-[0-9]*.rpm \
popt-[0-9]*.rpm \
prelink-[0-9]*.rpm \
procps-[0-9]*.rpm \
psmisc-[0-9]*.rpm \
python-[0-9]*.rpm \
python-elementtree-[0-9]*.rpm \
python-iniparse-[0-9]*.rpm \
python-sqlite-[0-9]*.rpm \
python-urlgrabber-[0-9]*.rpm \
readline-[0-9]*.rpm \
redhat-logos-[0-9]*.rpm \
rhpl-[0-9]*.rpm \
rootfiles-[0-9]*.rpm \
rpm-[0-9]*.rpm \
rpm-libs-[0-9]*.rpm \
rpm-python-[0-9]*.rpm \
sed-[0-9]*.rpm \
selinux-policy-[0-9]*.rpm \
selinux-policy-targeted-[0-9]*.rpm \
setools-[0-9]*.rpm \
setserial-[0-9]*.rpm \
shadow-utils-[0-9]*.rpm \
slang-[0-9]*.rpm \
sqlite-[0-9]*.rpm \
sysfsutils-[0-9]*.rpm \
sysklogd-[0-9]*.rpm \
system-config-securitylevel-tui-[0-9]*.rpm \
SysVinit-[0-9]*.rpm \
tar-[0-9]*.rpm \
tcl-[0-9]*.rpm \
tcp_wrappers-[0-9]*.rpm \
termcap-[0-9]*.rpm \
tzdata-[0-9]*.rpm \
udev-[0-9]*.rpm \
udftools-[0-9]*.rpm \
usermode-[0-9]*.rpm \
util-linux-[0-9]*.rpm \
vim-minimal-[0-9]*.rpm \
wireless-tools-[0-9]*.rpm \
yum-[0-9]*.rpm \
yum-metadata-parser-[0-9]*.rpm \
zlib-[0-9]*.rpm
If you perform the command, the following will show indicating that the installation process started.

This will again take some time... and will eventually result in the following.

If no error occurred you can start with the post-installation to make the system usable from coLinux.
Post-installation
We will now perform some post-installation commands to finish the installation. Create the device nodes in the device directory. These will be used by the filesystem table to mount the filesystem. Do not forget to first exit out of the chroot environment.
exit
mknod -m 666 /mnt/linux/dev/null c 1 3
for i in 0 1 2 3 4 5 6 7 8 9 10
do
mknod -m 660 /mnt/linux/dev/cobd${i} b 117 ${i}
done
chown 0:6 /mnt/linux/dev/cobd*
To have the filesystems mounted on startup you need to have the fstab file being created. Just overwrite the current file:
cat > /mnt/linux/etc/fstab << END
/dev/cobd0 / ext3 defaults 1 1
/dev/cobd7 swap swap defaults 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
none /sys sysfs defaults 0 0
END
Write some basic information to the hosts file.
cat > /mnt/linux/etc/hosts << END
127.0.0.1 localhost localhost.localdomain
END
The following will create the shared memory and the pseudo terminal devices, turns off the hardware daemon and allows you to give an initial password for the root user.
chroot /mnt/linux /sbin/MAKEDEV con
chroot /mnt/linux /bin/bash -c "/bin/mkdir /dev/{shm,pts}"
chroot /mnt/linux /bin/bash -c "/bin/chmod a+rwxt /dev/shm"
chroot /mnt/linux /sbin/MAKEDEV generic
chroot /mnt/linux /sbin/chkconfig haldaemon off
chroot /mnt/linux /usr/sbin/authconfig --enableshadow --update
chroot /mnt/linux /usr/bin/passwd root
To have the network start, you need to create the following files. This way your system will be configured with a basic hostname and two network devices using DHCP.
cat > /mnt/linux/etc/sysconfig/network << END
NETWORKING=yes
HOSTNAME=localhost.localdomain
END
cat > /mnt/linux/etc/sysconfig/network-scripts/ifcfg-eth0 << END
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
END
cat > /mnt/linux/etc/sysconfig/network-scripts/ifcfg-eth0 << END
DEVICE=eth1
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
END
Cleanup
You can now remove the base directory we had copied from the stage2 image.
rm -rf /mnt/linux/base
halt
After this you can halt the system and start the environment using the run.bat file. If everything went well your system would look like this!

During startup you will notice some minor error which are related to the kernel dependencies file being missing. To solve this, you can extract the kernel modules using the /dev/cofs0 mapping. Although I prefer to use RPMs, since they are easier to cleanup and upgrade when needed.
yum install wget
wget http://gbraad.fedorapeople.org/files/kernel-modules-2.6-co0.7.3.i386.rpm
rpm -ivh kernel-modules-2.6-co0.7.3.i386.rpm
Enjoy using it... If you have suggestions or stories about your use, leave a comment or send me an email.

0 comments:
Post a Comment