Tiny CentOS 5.5 32 bit (i386)

From WBITT's Cooker!

(Difference between revisions)
Jump to: navigation, search
(Test the stuff you just build (the bootable ISO image))
(Summary)
 
(31 intermediate revisions not shown)
Line 1: Line 1:
-
==Summary==
+
<b>CentOS-5.5-i386 minimalistic Server CD</b>
-
Based on my previous (unfinished) article on creating a Tiny CentOS distribution, I have created this article. This one is finished (almost).  
+
-
As I mentioned earlier. The idea is to have an absolute minimum number of packages. The driving force behind this thought is the latest RedHat Virtualization solution, RHEV, or, RedHat Enterprise Virtualization. RHEV is a slim/cut down version of RHEL 6, working as a KVM Hypervisor, with a very small install foot-print. I noticed that it is a similar concept as Citrix XEN Server. So, I wanted to see, if I can be successful in creating a similar product, based on CentOS 5.5. Notice that the procedure explained below DOES NOT contain libvirt, as yet. This is only because I was first interested in creating a distribution as small as possible. Since I have included yum in it, I (and you) can add any other RPM based package to it, without a problem. In coming days however, I will release a (so called) hypervisor version, InshaAllah (God Willing).
+
==Why a small/server CD in the first place?==
 +
Well, the key benefits are:
 +
* centos.org does not provide a server CD for centos 5.5. That is a good enough reason to create one ourselves, in the first place.
 +
* Small ISO size, makes it easier and ideal to download, even in bandwidth/volume limited environments.
 +
* Less packages means, less vulnerabilities (if you decide to use it in production).
 +
* Less holes to exploit
 +
* Less packages to update, when any updates are released from upstream vendor. This results in faster update of the system. And low bandwidth consumption. In case you have a farm of such "thin" servers, lesser bandwidth would be needed to update all of the servers in your farm, compared to fat installations.
 +
* Delivers you SSH and YUM, so you can add anything you want, on top of it.
 +
* Creates a very small (534 MB) foot print on the disk. The Virtual machines, can now be assigned virtual disks, as low as 1.5 GB in size (tested) , or 1.0 GB in size (not tested yet).
 +
* Multiple small VMs can be created in a disk constrained physical machine. 10 Virtual Machines would roughly consume about 15 GB of space.
 +
* Once it is installed on a VM and rebooted, you can change the memory assignment to the VM, lowering it to 64 MB. And it will still work! (tested).
 +
* Ideal for a small cluster.
 +
* Provides HTTPD, out of the box, so if (for some reason) you can't connect your (v/p) box to the internet, you can still extract some productivity out of your (v/p) machine.
 +
 
 +
[v/p = Virtual or Physical]
 +
 
 +
==Summary==
 +
As I mentioned earlier. The idea is to have an absolute minimum number of packages. The driving force behind this thought was a need to have such a small CD, which would be easier to download and distribute, with a capability to be topped up with additional packages from the internet, when necessary. And effective enough to get the job done. Since I have included yum in it, I (and you) can add any other RPM based package to it, without a problem. In coming days however, I will release a (so called) hypervisor version, InshaAllah (God Willing). Update: HypervisorEdition is released. [[CentOS 5.5 x86 64 Hypervisor Edition (Minimal)]]
CENTOS/RHEL already has a @core group (option), which can be used in the kickstart based installation. Even that takes up considerable space and installs CUPS, SENDMAIL and a lot of other un-necessary packages.  
CENTOS/RHEL already has a @core group (option), which can be used in the kickstart based installation. Even that takes up considerable space and installs CUPS, SENDMAIL and a lot of other un-necessary packages.  
-
Since I wanted to create a very small list of RPMS. I came up with a plan. I started with kernel, and kept trying to install the related RPMS in a temporary directory using RPM. I continued including missing files (RPMS), which were being reported by RPM as required dependencies. When all dependencies got resolved, I believed I had the desired minimal file list.  
+
Since I wanted to create a very small list of RPMS. I came up with a plan. I started with kernel, and kept trying to install the related RPMS in a temporary directory using RPM. I continued including missing files (RPMS), which were being reported by RPM as required dependencies. When all dependencies got resolved, I believed I had the desired minimal file list. Update: Can be done with more ease, using yumdownloader.
When I completed the basic minimal list, I added ssh-server, wget and yum to it. I further added the following: grub (boot loader), openssh-clients (for ssh, scp, sftp, etc), and vim-minimal (editor).
When I completed the basic minimal list, I added ssh-server, wget and yum to it. I further added the following: grub (boot loader), openssh-clients (for ssh, scp, sftp, etc), and vim-minimal (editor).
-
That would essentially make it a working server installation/distribution. Anything else can be added through "yum". The packages size is 108 RPM files (CENTOS), and 124 MB in total.
+
Note that I (generated and) tested this on a KVM based VM.
-
 
+
-
Note that I (generated and) tested this on a KVM based VM. This list does not include kernel-xen. You should add kernel-xen RPM to the rpm list, if you intend to use it either as XEN host, or XEN VM.  
+
==Infrastructure==
==Infrastructure==
Line 42: Line 56:
<pre>
<pre>
[root@fedora14 cdimages]# cat /etc/exports
[root@fedora14 cdimages]# cat /etc/exports
-
/data/cdimages 192.168.122.0/255.255.255.0(rw,no_root_squash).
+
/data/cdimages 192.168.122.0/255.255.255.0(rw,no_root_squash)
[root@fedora14 cdimages]#
[root@fedora14 cdimages]#
Line 59: Line 73:
</pre>
</pre>
The BuildHost has only 512 MB Virtual Memory, and 2GB Virtual Disk. We basically do not need much disk space on the build host. The BuildHost (VM) has the IP: 192.168.122.94, on its eth0 interface.
The BuildHost has only 512 MB Virtual Memory, and 2GB Virtual Disk. We basically do not need much disk space on the build host. The BuildHost (VM) has the IP: 192.168.122.94, on its eth0 interface.
-
 
==Steps==
==Steps==
Line 195: Line 208:
(No errors. Good!)
(No errors. Good!)
-
Please note that the most minimalistic list of packages, obtained by the process above, does not contain any servers. Even the ssh server is not there, so I added a couple of RPMs to this list. I added openssh-server, openssh-clients, wget, yum, vim-minimal, rootfiles, dhclient and grub (and their corresponding dependencies).
+
Please note that the most minimalistic list of packages, obtained by the process above, does not contain any servers. Even the ssh server is not there, so I added a couple of RPMs to this list. I added kernel-xen, openssh-server, openssh-clients, iptables, wget, yum, vim-minimal, rootfiles, dhclient and grub (and their corresponding dependencies).
Once I have all the RPMs in the /tmp/rpms directory, and no more dependencies are required, I synced that (/tmp/rpms) to /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/ . (Need to create this directory, because we excluded this once we copied the base structure.)
Once I have all the RPMs in the /tmp/rpms directory, and no more dependencies are required, I synced that (/tmp/rpms) to /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/ . (Need to create this directory, because we excluded this once we copied the base structure.)
Line 211: Line 224:
Total number of packages, and their total size (un-installed):
Total number of packages, and their total size (un-installed):
<pre>
<pre>
-
[root@buildhost tmp]# ls /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/ | wc -l
+
[root@buildhost-32 tmp]# ls rpms/ | wc -l
-
111
+
131
-
[root@buildhost tmp]# du -sh  /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/  
+
[root@buildhost-32 tmp]# du -sh  rpms/  
-
124M /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/
+
149M rpms/
</pre>
</pre>
Line 221: Line 234:
<pre>
<pre>
[root@buildhost tmp]# ls /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/
[root@buildhost tmp]# ls /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/
 +
apr-1.2.7-11.el5_3.1.i386.rpm
 +
apr-util-1.2.7-11.el5.i386.rpm
audit-libs-1.7.17-3.el5.i386.rpm
audit-libs-1.7.17-3.el5.i386.rpm
 +
audit-libs-python-1.7.17-3.el5.i386.rpm
basesystem-8.0-5.1.1.el5.centos.noarch.rpm
basesystem-8.0-5.1.1.el5.centos.noarch.rpm
bash-3.2-24.el5.i386.rpm
bash-3.2-24.el5.i386.rpm
Line 228: Line 244:
centos-release-5-5.el5.centos.i386.rpm
centos-release-5-5.el5.centos.i386.rpm
centos-release-notes-5.5-0.i386.rpm
centos-release-notes-5.5-0.i386.rpm
 +
checkpolicy-1.33.1-6.el5.i386.rpm
chkconfig-1.3.30.2-2.el5.i386.rpm
chkconfig-1.3.30.2-2.el5.i386.rpm
coreutils-5.97-23.el5_4.2.i386.rpm
coreutils-5.97-23.el5_4.2.i386.rpm
Line 234: Line 251:
cracklib-dicts-2.8.9-3.3.i386.rpm
cracklib-dicts-2.8.9-3.3.i386.rpm
crontabs-1.10-8.noarch.rpm
crontabs-1.10-8.noarch.rpm
 +
cyrus-sasl-lib-2.1.22-5.el5_4.3.i386.rpm
db4-4.3.29-10.el5.i386.rpm
db4-4.3.29-10.el5.i386.rpm
device-mapper-1.02.39-1.el5.i386.rpm
device-mapper-1.02.39-1.el5.i386.rpm
device-mapper-event-1.02.39-1.el5.i386.rpm
device-mapper-event-1.02.39-1.el5.i386.rpm
device-mapper-multipath-0.4.7-34.el5.i386.rpm
device-mapper-multipath-0.4.7-34.el5.i386.rpm
 +
dhclient-3.0.5-23.el5.i386.rpm
diffutils-2.8.1-15.2.3.el5.i386.rpm
diffutils-2.8.1-15.2.3.el5.i386.rpm
dmraid-1.0.0.rc13-63.el5.i386.rpm
dmraid-1.0.0.rc13-63.el5.i386.rpm
Line 246: Line 265:
ethtool-6-4.el5.i386.rpm
ethtool-6-4.el5.i386.rpm
expat-1.95.8-8.3.el5_4.2.i386.rpm
expat-1.95.8-8.3.el5_4.2.i386.rpm
 +
file-4.17-15.el5_3.1.i386.rpm
filesystem-2.4.0-3.el5.i386.rpm
filesystem-2.4.0-3.el5.i386.rpm
findutils-4.2.27-6.el5.i386.rpm
findutils-4.2.27-6.el5.i386.rpm
Line 259: Line 279:
gzip-1.3.5-11.el5.centos.1.i386.rpm
gzip-1.3.5-11.el5.centos.1.i386.rpm
hmaccalc-0.9.6-3.el5.i386.rpm
hmaccalc-0.9.6-3.el5.i386.rpm
 +
httpd-2.2.3-43.el5.centos.i386.rpm
info-4.8-14.el5.i386.rpm
info-4.8-14.el5.i386.rpm
initscripts-8.45.30-2.el5.centos.i386.rpm
initscripts-8.45.30-2.el5.centos.i386.rpm
iproute-2.6.18-11.el5.i386.rpm
iproute-2.6.18-11.el5.i386.rpm
 +
iptables-1.3.5-5.3.el5_4.1.i386.rpm
iputils-20020927-46.el5.i386.rpm
iputils-20020927-46.el5.i386.rpm
kernel-2.6.18-194.el5.i686.rpm
kernel-2.6.18-194.el5.i686.rpm
 +
kernel-xen-2.6.18-194.el5.i686.rpm
keyutils-libs-1.2-1.el5.i386.rpm
keyutils-libs-1.2-1.el5.i386.rpm
kpartx-0.4.7-34.el5.i386.rpm
kpartx-0.4.7-34.el5.i386.rpm
Line 273: Line 296:
libgcc-4.1.2-48.el5.i386.rpm
libgcc-4.1.2-48.el5.i386.rpm
libselinux-1.33.4-5.5.el5.i386.rpm
libselinux-1.33.4-5.5.el5.i386.rpm
 +
libselinux-python-1.33.4-5.5.el5.i386.rpm
 +
libselinux-utils-1.33.4-5.5.el5.i386.rpm
 +
libsemanage-1.9.1-4.4.el5.i386.rpm
libsepol-1.15.2-3.el5.i386.rpm
libsepol-1.15.2-3.el5.i386.rpm
libstdc++-4.1.2-48.el5.i386.rpm
libstdc++-4.1.2-48.el5.i386.rpm
Line 281: Line 307:
lvm2-2.02.56-8.el5.i386.rpm
lvm2-2.02.56-8.el5.i386.rpm
m2crypto-0.16-6.el5.6.i386.rpm
m2crypto-0.16-6.el5.6.i386.rpm
 +
mailcap-2.1.23-1.fc6.noarch.rpm
MAKEDEV-3.23-1.2.i386.rpm
MAKEDEV-3.23-1.2.i386.rpm
mcstrans-0.2.11-3.el5.i386.rpm
mcstrans-0.2.11-3.el5.i386.rpm
Line 292: Line 319:
nspr-4.7.6-1.el5_4.i386.rpm
nspr-4.7.6-1.el5_4.i386.rpm
nss-3.12.3.99.3-1.el5.centos.2.i386.rpm
nss-3.12.3.99.3-1.el5.centos.2.i386.rpm
 +
openldap-2.3.43-12.el5.i386.rpm
openssh-4.3p2-41.el5.i386.rpm
openssh-4.3p2-41.el5.i386.rpm
openssh-clients-4.3p2-41.el5.i386.rpm
openssh-clients-4.3p2-41.el5.i386.rpm
Line 298: Line 326:
pam-0.99.6.2-6.el5_4.1.i386.rpm
pam-0.99.6.2-6.el5_4.1.i386.rpm
pcre-6.6-2.el5_1.7.i386.rpm
pcre-6.6-2.el5_1.7.i386.rpm
 +
policycoreutils-1.33.12-14.8.el5.i386.rpm
popt-1.10.2.3-18.el5.i386.rpm
popt-1.10.2.3-18.el5.i386.rpm
 +
postgresql-libs-8.1.18-2.el5_4.1.i386.rpm
procps-3.2.7-16.el5.i386.rpm
procps-3.2.7-16.el5.i386.rpm
psmisc-22.2-7.i386.rpm
psmisc-22.2-7.i386.rpm
Line 308: Line 338:
readline-5.1-3.el5.i386.rpm
readline-5.1-3.el5.i386.rpm
redhat-logos-4.9.99-11.el5.centos.noarch.rpm
redhat-logos-4.9.99-11.el5.centos.noarch.rpm
 +
rootfiles-8.1-1.1.1.noarch.rpm
rpm-4.4.2.3-18.el5.i386.rpm
rpm-4.4.2.3-18.el5.i386.rpm
rpm-libs-4.4.2.3-18.el5.i386.rpm
rpm-libs-4.4.2.3-18.el5.i386.rpm
rpm-python-4.4.2.3-18.el5.i386.rpm
rpm-python-4.4.2.3-18.el5.i386.rpm
sed-4.1.5-5.fc6.i386.rpm
sed-4.1.5-5.fc6.i386.rpm
 +
selinux-policy-2.4.6-279.el5.noarch.rpm
 +
selinux-policy-targeted-2.4.6-279.el5.noarch.rpm
 +
setools-3.0-3.el5.i386.rpm
setup-2.5.58-7.el5.noarch.rpm
setup-2.5.58-7.el5.noarch.rpm
sgpio-1.2.0_10-2.el5.i386.rpm
sgpio-1.2.0_10-2.el5.i386.rpm
Line 319: Line 353:
SysVinit-2.86-15.el5.i386.rpm
SysVinit-2.86-15.el5.i386.rpm
tar-1.15.1-30.el5.i386.rpm
tar-1.15.1-30.el5.i386.rpm
 +
tcl-8.4.13-4.el5.i386.rpm
tcp_wrappers-7.6-40.7.el5.i386.rpm
tcp_wrappers-7.6-40.7.el5.i386.rpm
termcap-5.5-1.20060701.1.noarch.rpm
termcap-5.5-1.20060701.1.noarch.rpm
Line 334: Line 369:
===Few important points===
===Few important points===
-
When you install a server/pc with this distribution, you should note, that it can not query IP over DHCP, because it does not have dhclient RPM installed. Similarly the command prompt will be a simple "-bash-3.2#" . To change it, you may need to add rootfiles RPM to your distribution.
+
* This "Tiny" (aka minimal) installation CD has SELinux aware kernel. The following SELINUX rpms were added, which increased the size of the CD by 4 MB only.
-
 
+
<pre>
 +
setools-3.0-3.el5.i386.rpm
 +
checkpolicy-1.33.1-6.el5.i386.rpm
 +
policycoreutils-1.33.12-14.8.el5.i386.rpm
 +
tcl-8.4.13-4.el5.i386.rpm
 +
audit-libs-python-1.7.17-3.el5.i386.rpm
 +
libselinux-python-1.33.4-5.5.el5.i386.rpm
 +
libselinux-utils-1.33.4-5.5.el5.i386.rpm
 +
libsemanage-1.9.1-4.4.el5.i386.rpm
 +
selinux-policy-targeted-2.4.6-279.el5.noarch.rpm
 +
selinux-policy-2.4.6-279.el5.noarch.rpm
 +
</pre>
 +
* The following were not part of the original idea, but they were added to increase the usability of this CD: openssh-server, openssh-clients, iptables, wget, yum, vim-minimal, rootfiles, dhclient and grub. You can install rest of the stuff, to your heart's content, using yum.
 +
* kernel-xen is also added, in case this distribution is used to install XEN PVM, or XEN Physical Host. This increased the size of distribution by 19 MB.
 +
* Only SSH server is available on this distribution as a service, allowing you to logon to it remotely.
 +
* HTTPD was added, so this distribution can serve as a learning tool, for those who want to learn apache virtual hosting, especially, with SELINUX enabled in "Enforcing" mode. Addition of httpd, with it's dependencies has increased the size of distribution by 2.4 MB.
 +
<pre>
 +
httpd-2.2.3-43.el5.centos.i386.rpm
 +
apr-1.2.7-11.el5_3.1.i386.rpm
 +
apr-util-1.2.7-11.el5.i386.rpm
 +
postgresql-libs-8.1.18-2.el5_4.1.i386.rpm
 +
openldap-2.3.43-12.el5.i386.rpm
 +
cyrus-sasl-lib-2.1.22-5.el5_4.3.i386.rpm
 +
mailcap-2.1.23-1.fc6.noarch.rpm
 +
file-4.17-15.el5_3.1.i386.rpm
 +
</pre>
===Install necessary packages on the buildhost-32===
===Install necessary packages on the buildhost-32===
Line 406: Line 466:
       <packagereq type="default">dhclient</packagereq>
       <packagereq type="default">dhclient</packagereq>
       <packagereq type="default">rootfiles</packagereq>
       <packagereq type="default">rootfiles</packagereq>
 +
      <packagereq type="default">iptables</packagereq>
 +
      <packagereq type="default">setools</packagereq>
 +
      <packagereq type="default">checkpolicy</packagereq>
 +
      <packagereq type="default">policycoreutils</packagereq>
 +
      <packagereq type="default">tcl</packagereq>
 +
      <packagereq type="default">audit-libs-python</packagereq>
 +
      <packagereq type="default">libselinux-python</packagereq>
 +
      <packagereq type="default">libselinux-utils</packagereq>
 +
      <packagereq type="default">libsemanage</packagereq>
 +
      <packagereq type="default">selinux-policy</packagereq>
 +
      <packagereq type="default">selinux-policy-targeted</packagereq>
 +
      <packagereq type="default">httpd</packagereq>
 +
      <packagereq type="optional">kernel-xen</packagereq>
     </packagelist>
     </packagelist>
   </group>
   </group>
Line 447: Line 520:
[root@buildhost-32 CentOS-5.5-i386-tiny]# createrepo -u "media://$discinfo" -g repodata/comps.xml /mnt/cdimages/CentOS-5.5-i386-tiny/
[root@buildhost-32 CentOS-5.5-i386-tiny]# createrepo -u "media://$discinfo" -g repodata/comps.xml /mnt/cdimages/CentOS-5.5-i386-tiny/
-
111/111 - CentOS/fipscheck-lib-1.2.0-1.el5.i386.rpm                             
+
131/131 - CentOS/fipscheck-lib-1.2.0-1.el5.i386.rpm                             
Saving Primary metadata
Saving Primary metadata
Saving file lists metadata
Saving file lists metadata
Line 509: Line 582:
[root@buildhost-32 CentOS-5.5-i386-tiny]# mkisofs -r -R -J -T -v  \
[root@buildhost-32 CentOS-5.5-i386-tiny]# mkisofs -r -R -J -T -v  \
   -no-emul-boot -boot-load-size 4 -boot-info-table \
   -no-emul-boot -boot-load-size 4 -boot-info-table \
-
   -V "CentOS-5.5-Tiny 32 bit" -p "Kamran"  -A "CentOS-5.5-Tiny 32 bit-2010/12/18" \
+
   -V "CentOS-5.5-Tiny 32 bit" -p "KamranAzeem (kamran@wbitt.com)"  -A "CentOS-5.5-Tiny 32 bit-2010/12/18" \
   -b isolinux/isolinux.bin -c isolinux/boot.cat  -x "lost+found" \
   -b isolinux/isolinux.bin -c isolinux/boot.cat  -x "lost+found" \
   -o $isofilename /mnt/cdimages/CentOS-5.5-i386-tiny
   -o $isofilename /mnt/cdimages/CentOS-5.5-i386-tiny
Line 516: Line 589:
The output will look something like:
The output will look something like:
<pre>
<pre>
-
[root@buildhost-32 CentOS-5.5-i386-tiny]# mkisofs -r -R -J -T -v  -no-emul-boot -boot-load-size 4 -boot-info-table -V "CentOS-5.5-Tiny 32 bit" -p "KamranAzeem (kamran@wbitt.com)" -A "CentOS-5.5-Tiny 32 bit-2010/12/18"  -b isolinux/isolinux.bin -c isolinux/boot.cat  -x "lost+found"  -o $isofilename /mnt/cdimages/CentOS-5.5-i386-tiny
+
[root@buildhost-32 CentOS-5.5-i386-tiny]# mkisofs -r -R -J -T -v  -no-emul-boot -boot-load-size 4 \
 +
    -boot-info-table -V "CentOS-5.5-Tiny 32 bit" -p "KamranAzeem (kamran@wbitt.com)" \
 +
    -A "CentOS-5.5-Tiny 32 bit-2010/12/18"  -b isolinux/isolinux.bin -c isolinux/boot.cat  \
 +
    -x "lost+found"  -o $isofilename /mnt/cdimages/CentOS-5.5-i386-tiny
 +
 
INFO: UTF-8 character encoding detected by locale settings.
INFO: UTF-8 character encoding detected by locale settings.
Assuming UTF-8 encoded filenames on source filesystem,
Assuming UTF-8 encoded filenames on source filesystem,
Line 563: Line 640:
  96.34% done, estimate finish Sat Dec 18 07:41:02 2010
  96.34% done, estimate finish Sat Dec 18 07:41:02 2010
  99.26% done, estimate finish Sat Dec 18 07:41:02 2010
  99.26% done, estimate finish Sat Dec 18 07:41:02 2010
-
Total translation table size: 76462
+
Total translation table size: 47459
-
Total rockridge attributes bytes: 32069
+
Total rockridge attributes bytes: 20211
-
Total directory bytes: 51200
+
Total directory bytes: 32768
-
Path table size(bytes): 112
+
Path table size(bytes): 98
-
Done with: The File(s)                            Block(s)    171044
+
Done with: The File(s)                            Block(s)    176518
-
Writing:  Ending Padblock                        Start Block 171121
+
Writing:  Ending Padblock                        Start Block 176581
Done with: Ending Padblock                        Block(s)    150
Done with: Ending Padblock                        Block(s)    150
-
Max brk space used 5f000
+
Max brk space used 41000
-
171271 extents written (334 MB)
+
176731 extents written (345 MB)
[root@buildhost-32 CentOS-5.5-i386-tiny]#  
[root@buildhost-32 CentOS-5.5-i386-tiny]#  
</pre>
</pre>
-
The resultant file size is just 320 MB:
+
The resultant file size is just 346 MB:
<pre>
<pre>
[root@buildhost-32 CentOS-5.5-i386-tiny]# ls -lh /mnt/cdimages/CentOS-5.5-i386-tiny.iso  
[root@buildhost-32 CentOS-5.5-i386-tiny]# ls -lh /mnt/cdimages/CentOS-5.5-i386-tiny.iso  
-
-rw-r--r-- 1 107 107 320M Dec 18  2010 /mnt/cdimages/CentOS-5.5-i386-tiny.iso
+
-rw-r--r-- 1 107 107 346M Dec 18  2010 /mnt/cdimages/CentOS-5.5-i386-tiny.iso
[root@buildhost-32 CentOS-5.5-i386-tiny]#
[root@buildhost-32 CentOS-5.5-i386-tiny]#
</pre>
</pre>
Line 596: Line 673:
===Test the stuff you just build (the bootable ISO image)===
===Test the stuff you just build (the bootable ISO image)===
-
Now the Bootable-CD is created, as a result of last (mkisofs) step. I tested it to create a VM , on my Fedora 14 KVM host. It worked without a problem, in both text and GUI mode. Here are a few screen shots!
+
Now the Bootable-CD is created, as a result of last (mkisofs) step. I tested it to create a VM , on my Fedora 14 KVM host. It worked without a problem, in both text and GUI mode. Installed in 1 min 30 seconds! Consumes only 534 MB on the disk! Here are a few screen shots:-
 +
 
 +
[[File:Screenshot-centos-55-32-tiny-cd_Virtual_Machine-small.png]]
 +
 
 +
 
 +
Note: Just press ENTER/OK on this (package selection) screen.
 +
[[File:Screenshot-centos-55-32-tiny-cd Virtual Machine-2-small.png]]
 +
 
 +
 
 +
[[File:Screenshot-centos-55-32-tiny-cd Virtual Machine-3-small.png]]
-
[[File:Screenshot-centos-55-32-tiny-cd_Virtual_Machine-small.png]]
 
-
[[File:Screenshot-centos-55-32-tiny-cd_Virtual_Machine-1-small.png]]
 
 +
By the way, the MD5SUM of this ISO is: a1c203b64d11981d1d2f74f18db2d710
DONE!
DONE!

Current revision as of 06:43, 5 January 2011

CentOS-5.5-i386 minimalistic Server CD

Contents

Why a small/server CD in the first place?

Well, the key benefits are:

  • centos.org does not provide a server CD for centos 5.5. That is a good enough reason to create one ourselves, in the first place.
  • Small ISO size, makes it easier and ideal to download, even in bandwidth/volume limited environments.
  • Less packages means, less vulnerabilities (if you decide to use it in production).
  • Less holes to exploit
  • Less packages to update, when any updates are released from upstream vendor. This results in faster update of the system. And low bandwidth consumption. In case you have a farm of such "thin" servers, lesser bandwidth would be needed to update all of the servers in your farm, compared to fat installations.
  • Delivers you SSH and YUM, so you can add anything you want, on top of it.
  • Creates a very small (534 MB) foot print on the disk. The Virtual machines, can now be assigned virtual disks, as low as 1.5 GB in size (tested) , or 1.0 GB in size (not tested yet).
  • Multiple small VMs can be created in a disk constrained physical machine. 10 Virtual Machines would roughly consume about 15 GB of space.
  • Once it is installed on a VM and rebooted, you can change the memory assignment to the VM, lowering it to 64 MB. And it will still work! (tested).
  • Ideal for a small cluster.
  • Provides HTTPD, out of the box, so if (for some reason) you can't connect your (v/p) box to the internet, you can still extract some productivity out of your (v/p) machine.

[v/p = Virtual or Physical]

Summary

As I mentioned earlier. The idea is to have an absolute minimum number of packages. The driving force behind this thought was a need to have such a small CD, which would be easier to download and distribute, with a capability to be topped up with additional packages from the internet, when necessary. And effective enough to get the job done. Since I have included yum in it, I (and you) can add any other RPM based package to it, without a problem. In coming days however, I will release a (so called) hypervisor version, InshaAllah (God Willing). Update: HypervisorEdition is released. CentOS 5.5 x86 64 Hypervisor Edition (Minimal)

CENTOS/RHEL already has a @core group (option), which can be used in the kickstart based installation. Even that takes up considerable space and installs CUPS, SENDMAIL and a lot of other un-necessary packages.

Since I wanted to create a very small list of RPMS. I came up with a plan. I started with kernel, and kept trying to install the related RPMS in a temporary directory using RPM. I continued including missing files (RPMS), which were being reported by RPM as required dependencies. When all dependencies got resolved, I believed I had the desired minimal file list. Update: Can be done with more ease, using yumdownloader.

When I completed the basic minimal list, I added ssh-server, wget and yum to it. I further added the following: grub (boot loader), openssh-clients (for ssh, scp, sftp, etc), and vim-minimal (editor).

Note that I (generated and) tested this on a KVM based VM.

Infrastructure

Physical Host

The physical host is a Fedora 14 machine, with 4 GB RAM, and 200 GB of disk. Out of which about 70 GB is free space.

The disk has a directory /data/cdimages , which hosts various ISO images of different OS, I have. This directory has the following layout (only the part interesting to us is shown below).

[root@fedora14 cdimages]# tree -d
.
├── CentOS-5.5-i386
│   ├── CentOS
│   ├── images
│   │   ├── pxeboot
│   │   └── xen
│   ├── isolinux
│   ├── NOTES
│   └── repodata
└── CentOS-5.5-i386-tiny

The /data/cdimages/CentOS-5.5-i386 is the full DVD copied in this directory. If you cannot afford to download full DVD, (for perfectly understandable reasons), you can download the packages, directly from the CENTOS website. The method to do so, is already mentioned here: http://cooker.wbitt.com/index.php/CENTOS_Server_CD_project#Creating_the_.22core.22_install-tree_from_a_http_site

The /data/cdimages/CentOS-5.5-i386-tiny directory shown above, is an empty directory. It is possible that you do not have this directory created at this moment. We can create this directory at a later stage.

The directory /data/cdimages on the physical host, is made available as an NFS writeable share to the 192.168.122.0/24 network. As following:

[root@fedora14 cdimages]# cat /etc/exports
/data/cdimages 192.168.122.0/255.255.255.0(rw,no_root_squash)
[root@fedora14 cdimages]#

[root@fedora14 cdimages]# service nfs restart 

(Make sure that the firewall is not blocking incoming NFS requests on the physical host).

This is a good method to save space, both on the physical host and on the VMs. That means, you don't have to "fill-up" your build host (VM) will all the DVD/RPM files and ISO images. So they don't need large virtual disks for it. All of the work, can be performed, when we mount this directory /data/cdimages, from the physical host, to the buildhost-32 VM.

The physical host has the IP: 192.168.122.1 , on the virbr0 interface. It may (or may not) have any IP on it's eth0 interface, which is irrelevant to this text.

Build Host

The buildhost (named buildhost-32) is actually a CentOS 5.5 32 bit Virtual Machine running inside a Fedora 14 physical host. It is installed with the minimal installation available with default CENTOS installer. It has additional packages installed on it, which are:

[root@buildhost-32 ~]# yum -y install anaconda anaconda-runtime mkisofs cdrecord

The BuildHost has only 512 MB Virtual Memory, and 2GB Virtual Disk. We basically do not need much disk space on the build host. The BuildHost (VM) has the IP: 192.168.122.94, on its eth0 interface.

Steps

Make the repositories available on the buildhost-32

See if you are able to view the NFS share made available on the physical host.

[root@buildhost-32 ~]# showmount -e 192.168.122.1
Export list for 192.168.122.1:
/data/cdimages 192.168.122.0/255.255.255.0

Create a mount point on the build host, and mount the NFS share on it.

[root@buildhost-32 ~]# mkdir /mnt/cdimages

[root@buildhost-32 ~]# mount -t nfs 192.168.122.1:/data/cdimages/  /mnt/cdimages/

[root@buildhost-32 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/vda1             2.8G  913M  1.8G  34% /
tmpfs                 252M     0  252M   0% /dev/shm
192.168.122.1:/data/cdimages/
                      191G  113G   69G  63% /mnt/cdimages
[root@buildhost-32 ~]# 

As you can see, the /data/cdimages from the physical host is now available on our buildhost-32, as /mnt/cdimages.

Create an empty directory CentOS-5.5-i386-tiny inside /mnt/cdimages, if not already done so. It must be empty though. This directory is going to hold our new custom distribution.

[root@buildhost-32 ~]# mkdir /mnt/cdimages/CentOS-5.5-i386-tiny

Copy the DVD structure, (excluding the CentOS directory), from /mnt/cdimages/CentOS-5.5-i386/ to this newly created directory /mnt/cdimages/CentOS-5.5-i386-tiny/.

[root@buildhost-32 ~]# rsync -av --exclude CentOS/  \
   /mnt/cdimages/CentOS-5.5-i386/   /mnt/cdimages/CentOS-5.5-i386-tiny/

Without the CentOS directory, which holds all the RPMs of the distribution, the structure (with some necessary files), is about 226 MB in total.

[root@buildhost-32 ~]# du -sh /mnt/cdimages/CentOS-5.5-i386-tiny/
226M	/mnt/cdimages/CentOS-5.5-i386-tiny/
[root@buildhost-32 ~]# 

I created a temporary directory named /tmp/rpms, and started copying RPM files one by one from the original source distribution directory (/mnt/cdimages/CentOS-5.5-i386/CentOS) , to this directory. I started with the kernel RPM and kept testing the installation of the RPMS I copied, in the /tmp/RPMtest directory, which is again, a freshly created empty directory.

[root@buildhost-32 tmp]# mkdir /tmp/rpms

[root@buildhost-32 tmp]# mkdir /tmp/RPMtest

Copy one file at a time to the /tmp/rpms directory:


[root@buildhost-32 tmp]#  cp /mnt/cdimages/CentOS-5.5-i386/CentOS/kernel-2.6.18-194.el5.i686.rpm   \ 
  /tmp/rpms/

Used the following two commands to test install the rpms I placed in /tmp/rpms/ directory.

rpm --initdb --dbpath /tmp/RPMtest/ 
rpm --test --dbpath /tmp/RPMtest/ -ivh /tmp/rpms/*.rpm
[root@buildhost-32 tmp]# rpm --test --dbpath /tmp/RPMtest/ -ivh /tmp/rpms/*.rpm
warning: /tmp/rpms/kernel-2.6.18-194.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
        fileutils is needed by kernel-2.6.18-194.el5.i686
        module-init-tools is needed by kernel-2.6.18-194.el5.i686
        initscripts >= 8.11.1-1 is needed by kernel-2.6.18-194.el5.i686
        mkinitrd >= 4.2.21-1 is needed by kernel-2.6.18-194.el5.i686
        /bin/sh is needed by kernel-2.6.18-194.el5.i686
[root@buildhost-32 tmp]#

As you can see, now I need to copy more RPMs in the /tmp/rpms directory, to satisfy the dependencies problems seen above. This is a daunting manual task.

I created the following script, containing the same two lines to repeatedly test-install the RPMs.

[root@buildhost-32 tmp]# cat testrun.sh 
#!/bin/bash
rpm --initdb --dbpath /tmp/RPMtest/ 
rpm --test --dbpath /tmp/RPMtest/ -ivh /tmp/rpms/*.rpm
[root@buildhost-32 rpms]# 

Note: During one of the test installations by the testrun.sh script (shown above), I got the following errors:

[root@buildhost tmp]# ./testrun.sh 
. . . 
. . .  
	file /lib/libcrypto.so.0.9.8e conflicts between attempted installs of openssl-0.9.8e-12.el5_4.6.i386 and openssl-0.9.8e-12.el5_4.6.i686
	file /lib/libssl.so.0.9.8e conflicts between attempted installs of openssl-0.9.8e-12.el5_4.6.i386 and openssl-0.9.8e-12.el5_4.6.i686
	file /usr/bin/openssl conflicts between attempted installs of openssl-0.9.8e-12.el5_4.6.i386 and openssl-0.9.8e-12.el5_4.6.i686
	file /usr/lib/openssl/engines/lib4758cca.so conflicts between attempted installs of openssl-0.9.8e-12.el5_4.6.i386 and openssl-0.9.8e-12.el5_4.6.i686
	file /usr/lib/openssl/engines/libaep.so conflicts between attempted installs of openssl-0.9.8e-12.el5_4.6.i386 and openssl-0.9.8e-12.el5_4.6.i686
	file /usr/lib/openssl/engines/libatalla.so conflicts between attempted installs of openssl-0.9.8e-12.el5_4.6.i386 and openssl-0.9.8e-12.el5_4.6.i686
	file /usr/lib/openssl/engines/libchil.so conflicts between attempted installs of openssl-0.9.8e-12.el5_4.6.i386 and openssl-0.9.8e-12.el5_4.6.i686
	file /usr/lib/openssl/engines/libcswift.so conflicts between attempted installs of openssl-0.9.8e-12.el5_4.6.i386 and openssl-0.9.8e-12.el5_4.6.i686
	file /usr/lib/openssl/engines/libnuron.so conflicts between attempted installs of openssl-0.9.8e-12.el5_4.6.i386 and openssl-0.9.8e-12.el5_4.6.i686
	file /usr/lib/openssl/engines/libsureware.so conflicts between attempted installs of openssl-0.9.8e-12.el5_4.6.i386 and openssl-0.9.8e-12.el5_4.6.i686
	file /usr/lib/openssl/engines/libubsec.so conflicts between attempted installs of openssl-0.9.8e-12.el5_4.6.i386 and openssl-0.9.8e-12.el5_4.6.i686

This happened because few RPMs (three in the list above), had both package.i386.rpm and package.i686.rpm files present in the same directories. Thus there was a conflict. So I pulled out the i686 rpms from the list:

[root@buildhost tmp]# mv rpms/*.i686*   .

Checked the list of files pulled out, and found that there are three (3) .i686 files: glibc, openssl, and kernel.

[root@buildhost tmp]# ls *.rpm
glibc-2.5-49.i686.rpm           openssl-0.9.8e-12.el5_4.6.i686.rpm           kernel-2.6.18-194.el5.i686.rpm

kernel does not have a corresponding i386 rpm file, so kernel needs to be back inside the rpms directory.

[root@buildhost tmp]# mv kernel-2.6.18-194.el5.i686.rpm rpms/

Re-ran the testrun.sh script to see if there are any conflicts anymore.

[root@buildhost tmp]# ./testrun.sh 
warning: /tmp/rpms/audit-libs-1.7.17-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
[root@buildhost tmp]#

(No errors. Good!)

Please note that the most minimalistic list of packages, obtained by the process above, does not contain any servers. Even the ssh server is not there, so I added a couple of RPMs to this list. I added kernel-xen, openssh-server, openssh-clients, iptables, wget, yum, vim-minimal, rootfiles, dhclient and grub (and their corresponding dependencies).

Once I have all the RPMs in the /tmp/rpms directory, and no more dependencies are required, I synced that (/tmp/rpms) to /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/ . (Need to create this directory, because we excluded this once we copied the base structure.)

[root@buildhost-32 tmp]# mkdir /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/

[root@buildhost-32 tmp]# rsync -av  /tmp/rpms/   /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/

Complete list of RPMs

First, here are the basic stats of the list of RPMs I have:

Total number of packages, and their total size (un-installed):

[root@buildhost-32 tmp]# ls rpms/ | wc -l
131

[root@buildhost-32 tmp]# du -sh  rpms/ 
149M	rpms/

List of RPMs:

[root@buildhost tmp]# ls /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/
apr-1.2.7-11.el5_3.1.i386.rpm
apr-util-1.2.7-11.el5.i386.rpm
audit-libs-1.7.17-3.el5.i386.rpm
audit-libs-python-1.7.17-3.el5.i386.rpm
basesystem-8.0-5.1.1.el5.centos.noarch.rpm
bash-3.2-24.el5.i386.rpm
binutils-2.17.50.0.6-14.el5.i386.rpm
bzip2-libs-1.0.3-4.el5_2.i386.rpm
centos-release-5-5.el5.centos.i386.rpm
centos-release-notes-5.5-0.i386.rpm
checkpolicy-1.33.1-6.el5.i386.rpm
chkconfig-1.3.30.2-2.el5.i386.rpm
coreutils-5.97-23.el5_4.2.i386.rpm
cpio-2.6-23.el5_4.1.i386.rpm
cracklib-2.8.9-3.3.i386.rpm
cracklib-dicts-2.8.9-3.3.i386.rpm
crontabs-1.10-8.noarch.rpm
cyrus-sasl-lib-2.1.22-5.el5_4.3.i386.rpm
db4-4.3.29-10.el5.i386.rpm
device-mapper-1.02.39-1.el5.i386.rpm
device-mapper-event-1.02.39-1.el5.i386.rpm
device-mapper-multipath-0.4.7-34.el5.i386.rpm
dhclient-3.0.5-23.el5.i386.rpm
diffutils-2.8.1-15.2.3.el5.i386.rpm
dmraid-1.0.0.rc13-63.el5.i386.rpm
dmraid-events-1.0.0.rc13-63.el5.i386.rpm
e2fsprogs-1.39-23.el5.i386.rpm
e2fsprogs-libs-1.39-23.el5.i386.rpm
elfutils-libelf-0.137-3.el5.i386.rpm
ethtool-6-4.el5.i386.rpm
expat-1.95.8-8.3.el5_4.2.i386.rpm
file-4.17-15.el5_3.1.i386.rpm
filesystem-2.4.0-3.el5.i386.rpm
findutils-4.2.27-6.el5.i386.rpm
fipscheck-1.2.0-1.el5.i386.rpm
fipscheck-lib-1.2.0-1.el5.i386.rpm
gawk-3.1.5-14.el5.i386.rpm
gdbm-1.8.0-26.2.1.i386.rpm
glib2-2.12.3-4.el5_3.1.i386.rpm
glibc-2.5-49.i386.rpm
glibc-common-2.5-49.i386.rpm
grep-2.5.1-55.el5.i386.rpm
grub-0.97-13.5.i386.rpm
gzip-1.3.5-11.el5.centos.1.i386.rpm
hmaccalc-0.9.6-3.el5.i386.rpm
httpd-2.2.3-43.el5.centos.i386.rpm
info-4.8-14.el5.i386.rpm
initscripts-8.45.30-2.el5.centos.i386.rpm
iproute-2.6.18-11.el5.i386.rpm
iptables-1.3.5-5.3.el5_4.1.i386.rpm
iputils-20020927-46.el5.i386.rpm
kernel-2.6.18-194.el5.i686.rpm
kernel-xen-2.6.18-194.el5.i686.rpm
keyutils-libs-1.2-1.el5.i386.rpm
kpartx-0.4.7-34.el5.i386.rpm
krb5-libs-1.6.1-36.el5_4.1.i386.rpm
less-436-2.el5.i386.rpm
libacl-2.2.39-6.el5.i386.rpm
libattr-2.4.32-1.1.i386.rpm
libcap-1.10-26.i386.rpm
libgcc-4.1.2-48.el5.i386.rpm
libselinux-1.33.4-5.5.el5.i386.rpm
libselinux-python-1.33.4-5.5.el5.i386.rpm
libselinux-utils-1.33.4-5.5.el5.i386.rpm
libsemanage-1.9.1-4.4.el5.i386.rpm
libsepol-1.15.2-3.el5.i386.rpm
libstdc++-4.1.2-48.el5.i386.rpm
libsysfs-2.0.0-6.i386.rpm
libtermcap-2.0.8-46.1.i386.rpm
libxml2-2.6.26-2.1.2.8.i386.rpm
logrotate-3.7.4-9.i386.rpm
lvm2-2.02.56-8.el5.i386.rpm
m2crypto-0.16-6.el5.6.i386.rpm
mailcap-2.1.23-1.fc6.noarch.rpm
MAKEDEV-3.23-1.2.i386.rpm
mcstrans-0.2.11-3.el5.i386.rpm
mingetty-1.07-5.2.2.i386.rpm
mkinitrd-5.1.19.6-61.i386.rpm
mktemp-1.5-23.2.2.i386.rpm
module-init-tools-3.3-0.pre3.1.60.el5.i386.rpm
nash-5.1.19.6-61.i386.rpm
ncurses-5.5-24.20060715.i386.rpm
net-tools-1.60-81.el5.i386.rpm
nspr-4.7.6-1.el5_4.i386.rpm
nss-3.12.3.99.3-1.el5.centos.2.i386.rpm
openldap-2.3.43-12.el5.i386.rpm
openssh-4.3p2-41.el5.i386.rpm
openssh-clients-4.3p2-41.el5.i386.rpm
openssh-server-4.3p2-41.el5.i386.rpm
openssl-0.9.8e-12.el5_4.6.i386.rpm
pam-0.99.6.2-6.el5_4.1.i386.rpm
pcre-6.6-2.el5_1.7.i386.rpm
policycoreutils-1.33.12-14.8.el5.i386.rpm
popt-1.10.2.3-18.el5.i386.rpm
postgresql-libs-8.1.18-2.el5_4.1.i386.rpm
procps-3.2.7-16.el5.i386.rpm
psmisc-22.2-7.i386.rpm
python-2.4.3-27.el5.i386.rpm
python-elementtree-1.2.6-5.i386.rpm
python-iniparse-0.2.3-4.el5.noarch.rpm
python-sqlite-1.1.7-1.2.1.i386.rpm
python-urlgrabber-3.1.0-5.el5.noarch.rpm
readline-5.1-3.el5.i386.rpm
redhat-logos-4.9.99-11.el5.centos.noarch.rpm
rootfiles-8.1-1.1.1.noarch.rpm
rpm-4.4.2.3-18.el5.i386.rpm
rpm-libs-4.4.2.3-18.el5.i386.rpm
rpm-python-4.4.2.3-18.el5.i386.rpm
sed-4.1.5-5.fc6.i386.rpm
selinux-policy-2.4.6-279.el5.noarch.rpm
selinux-policy-targeted-2.4.6-279.el5.noarch.rpm
setools-3.0-3.el5.i386.rpm
setup-2.5.58-7.el5.noarch.rpm
sgpio-1.2.0_10-2.el5.i386.rpm
shadow-utils-4.0.17-15.el5.i386.rpm
sqlite-3.3.6-5.i386.rpm
sysklogd-1.4.1-46.el5.i386.rpm
SysVinit-2.86-15.el5.i386.rpm
tar-1.15.1-30.el5.i386.rpm
tcl-8.4.13-4.el5.i386.rpm
tcp_wrappers-7.6-40.7.el5.i386.rpm
termcap-5.5-1.20060701.1.noarch.rpm
tzdata-2010e-1.el5.noarch.rpm
udev-095-14.21.el5.i386.rpm
util-linux-2.13-0.52.el5_4.1.i386.rpm
vim-minimal-7.0.109-6.el5.i386.rpm
wget-1.11.4-2.el5_4.1.i386.rpm
yum-3.2.22-26.el5.centos.noarch.rpm
yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
zlib-1.2.3-3.i386.rpm
[root@buildhost tmp]#

Few important points

  • This "Tiny" (aka minimal) installation CD has SELinux aware kernel. The following SELINUX rpms were added, which increased the size of the CD by 4 MB only.
setools-3.0-3.el5.i386.rpm
checkpolicy-1.33.1-6.el5.i386.rpm
policycoreutils-1.33.12-14.8.el5.i386.rpm
tcl-8.4.13-4.el5.i386.rpm
audit-libs-python-1.7.17-3.el5.i386.rpm
libselinux-python-1.33.4-5.5.el5.i386.rpm
libselinux-utils-1.33.4-5.5.el5.i386.rpm
libsemanage-1.9.1-4.4.el5.i386.rpm
selinux-policy-targeted-2.4.6-279.el5.noarch.rpm
selinux-policy-2.4.6-279.el5.noarch.rpm
  • The following were not part of the original idea, but they were added to increase the usability of this CD: openssh-server, openssh-clients, iptables, wget, yum, vim-minimal, rootfiles, dhclient and grub. You can install rest of the stuff, to your heart's content, using yum.
  • kernel-xen is also added, in case this distribution is used to install XEN PVM, or XEN Physical Host. This increased the size of distribution by 19 MB.
  • Only SSH server is available on this distribution as a service, allowing you to logon to it remotely.
  • HTTPD was added, so this distribution can serve as a learning tool, for those who want to learn apache virtual hosting, especially, with SELINUX enabled in "Enforcing" mode. Addition of httpd, with it's dependencies has increased the size of distribution by 2.4 MB.
httpd-2.2.3-43.el5.centos.i386.rpm
apr-1.2.7-11.el5_3.1.i386.rpm
apr-util-1.2.7-11.el5.i386.rpm
postgresql-libs-8.1.18-2.el5_4.1.i386.rpm
openldap-2.3.43-12.el5.i386.rpm
cyrus-sasl-lib-2.1.22-5.el5_4.3.i386.rpm
mailcap-2.1.23-1.fc6.noarch.rpm
file-4.17-15.el5_3.1.i386.rpm

Install necessary packages on the buildhost-32

Once the RPM list is finalized, it is time to re-build the comps.xml file for it, and then build an ISO file out of it.

First, install the packages required to build the distribution, on the buildhost.

[root@buildhost-32 ~]# yum -y install anaconda anaconda-runtime mkisofs cdrecord

Edit and re-build the comps.xml file

The original comps.xml file is 11418 lines.

[root@buildhost-32 tmp]# wc -l /mnt/cdimages/CentOS-5.5-i386-tiny/repodata/comps.xml 
11418 /mnt/cdimages/CentOS-5.5-i386-tiny/repodata/comps.xml

Most of it is "xml:lang" lines. Lets get rid of them, to create a (so called) language free file.

[root@buildhost-32 tmp]# grep -v  "xml:lang" /mnt/cdimages/CentOS-5.5-i386-tiny/repodata/comps.xml > /tmp/no-lang.comps.xml

[root@buildhost-32 tmp]# wc -l /tmp/no-lang.comps.xml 
2607 /tmp/no-lang.comps.xml

After hand editing the file, and removing everything, which I did not need, here is the final version, comprising of only 58 lines in total. Notice that I changed the name of "core" to "tiny". This is the name of the group you will need to use in your kickstart.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE newcomps PUBLIC "-//CentOS//DTD Comps info//EN" "comps.dtd">
<comps>
  <group>
    <id>tiny</id>
    <name>Tiny</name>
    <description>Tiniest possible installation</description>
    <default>true</default>
    <uservisible>false</uservisible>
    <packagelist>
      <packagereq type="mandatory">SysVinit</packagereq>
      <packagereq type="mandatory">basesystem</packagereq>
      <packagereq type="mandatory">bash</packagereq>
      <packagereq type="mandatory">centos-release</packagereq>
      <packagereq type="mandatory">coreutils</packagereq>
      <packagereq type="mandatory">cpio</packagereq>
      <packagereq type="mandatory">e2fsprogs</packagereq>
      <packagereq type="mandatory">redhat-logos</packagereq>
      <packagereq type="mandatory">centos-release-notes</packagereq>
      <packagereq type="mandatory">filesystem</packagereq>
      <packagereq type="mandatory">glibc</packagereq>
      <packagereq type="mandatory">initscripts</packagereq>
      <packagereq type="mandatory">iproute</packagereq>
      <packagereq type="mandatory">iputils</packagereq>
      <packagereq type="mandatory">libgcc</packagereq>
      <packagereq type="mandatory">libtermcap</packagereq>
      <packagereq type="mandatory">mkinitrd</packagereq>
      <packagereq type="mandatory">procps</packagereq>
      <packagereq type="mandatory">readline</packagereq>
      <packagereq type="mandatory">rpm</packagereq>
      <packagereq type="mandatory">setup</packagereq>
      <packagereq type="mandatory">shadow-utils</packagereq>
      <packagereq type="mandatory">sysklogd</packagereq>
      <packagereq type="mandatory">termcap</packagereq>
      <packagereq type="mandatory">util-linux</packagereq>
      <packagereq type="mandatory">vim-minimal</packagereq>
      <packagereq type="default">grub</packagereq>
      <packagereq type="default">openssh-clients</packagereq>
      <packagereq type="default">openssh-server</packagereq>
      <packagereq type="default">yum</packagereq>
      <packagereq type="default">wget</packagereq>
      <packagereq type="default">dhclient</packagereq>
      <packagereq type="default">rootfiles</packagereq>
      <packagereq type="default">iptables</packagereq>
      <packagereq type="default">setools</packagereq>
      <packagereq type="default">checkpolicy</packagereq>
      <packagereq type="default">policycoreutils</packagereq>
      <packagereq type="default">tcl</packagereq>
      <packagereq type="default">audit-libs-python</packagereq>
      <packagereq type="default">libselinux-python</packagereq>
      <packagereq type="default">libselinux-utils</packagereq>
      <packagereq type="default">libsemanage</packagereq>
      <packagereq type="default">selinux-policy</packagereq>
      <packagereq type="default">selinux-policy-targeted</packagereq>
      <packagereq type="default">httpd</packagereq>
      <packagereq type="optional">kernel-xen</packagereq>
    </packagelist>
  </group>

  <category>
    <id>tiny-system</id>
    <name>Tiny System</name>
    <description>Tiniest pieces of the system.</description>
    <display_order>1</display_order>
    <grouplist>
      <groupid>tiny</groupid>
    </grouplist>
  </category>

</comps>

Now remove all files from /mnt/cdimages/CentOS-5.5-i386-tiny/repodata . Then copy this no-lang.comps.xml file to that location.

[root@buildhost-32 tmp]# rm /mnt/cdimages/CentOS-5.5-i386-tiny/repodata/* -fr
[root@buildhost-32 tmp]# cp /tmp/no-lang.comps.xml /mnt/cdimages/CentOS-5.5-i386-tiny/repodata/

Now rebuild the repodata:

[root@buildhost-32 tmp]# cd /mnt/cdimages/CentOS-5.5-i386-tiny/

[root@buildhost-32 CentOS-5.5-i386-tiny]# cat .discinfo 
1272587247.016243
Final
i386
1,2,3,4,5,6
CentOS/base
/home/buildcentos/CENTOS/5.5/en/i386/CentOS
CentOS/pixmaps

[root@buildhost-32 CentOS-5.5-i386-tiny]# export discinfo=$(head -1 /mnt/cdimages/CentOS-5.5-i386-tiny/.discinfo)

[root@buildhost-32 CentOS-5.5-i386-tiny]# echo $discinfo 
1272587247.016243

[root@buildhost-32 CentOS-5.5-i386-tiny]# createrepo -u "media://$discinfo" -g repodata/comps.xml /mnt/cdimages/CentOS-5.5-i386-tiny/
131/131 - CentOS/fipscheck-lib-1.2.0-1.el5.i386.rpm                             
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@buildhost-32 CentOS-5.5-i386-tiny]#

Alhumdulillah. Repository created.

Create Bootable ISO file

If the previous step did not give you any errors, you are now ready to create the actual bootable CD / ISO file out of this build-tree!

Note: You may want to remove the NOTES directory from the build root, which is 17 MB in size. Also you may want to create a sample kickstart file for reference and place it in the build root.

[root@buildhost-32 CentOS-5.5-i386-tiny]# rm -fr NOTES

[root@buildhost-32 CentOS-5.5-i386-tiny]# cat sample.ks 
# A minimalistic kickstart file by Kamran Azeem (kamran@wbitt.com)
# Created: 2010-12-18
# Note: Please use at your own risk!
# ################################################################
install
text
# url --url http://192.168.122.94/CentOS-5.5-i386-tiny/
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp --hostname centos-55-32-tiny --noipv6
# The password is redhat
rootpw --iscrypted $1$Q6duWtpC$OcyfP8NCdH1EZBxHmM/tL0
firewall --disabled
authconfig --enableshadow --enablemd5
selinux --disabled
timezone Asia/Riyadh
zerombr
bootloader --location=mbr  --append=""

# I prefer you create at least a 1.5 GB disk for the minimal install.
# Adjust the following three lines as needed.
# clearpart --all --initlabel
# part / --fstype=ext3 --size=200 --grow
# part swap --fstype=swap --size=128
reboot

%packages
@tiny

%post
chkconfig --level 35 sendmail off
chkconfig --level 35 cups off

[root@buildhost-32 CentOS-5.5-i386-tiny]#

Now, build the ISO file:

[root@buildhost-32 tmp]# cd /mnt/cdimages/CentOS-5.5-i386-tiny/

[root@buildhost-32 CentOS-5.5-i386-tiny]# export isofilename=/mnt/cdimages/CentOS-5.5-i386-tiny.iso

[root@buildhost-32 CentOS-5.5-i386-tiny]# mkisofs -r -R -J -T -v  \
   -no-emul-boot -boot-load-size 4 -boot-info-table \
   -V "CentOS-5.5-Tiny 32 bit" -p "KamranAzeem (kamran@wbitt.com)"  -A "CentOS-5.5-Tiny 32 bit-2010/12/18" \
   -b isolinux/isolinux.bin -c isolinux/boot.cat  -x "lost+found" \
   -o $isofilename /mnt/cdimages/CentOS-5.5-i386-tiny

The output will look something like:

[root@buildhost-32 CentOS-5.5-i386-tiny]# mkisofs -r -R -J -T -v  -no-emul-boot -boot-load-size 4  \ 
    -boot-info-table -V "CentOS-5.5-Tiny 32 bit" -p "KamranAzeem (kamran@wbitt.com)" \ 
    -A "CentOS-5.5-Tiny 32 bit-2010/12/18"  -b isolinux/isolinux.bin -c isolinux/boot.cat  \
    -x "lost+found"  -o $isofilename /mnt/cdimages/CentOS-5.5-i386-tiny

INFO:	UTF-8 character encoding detected by locale settings.
	Assuming UTF-8 encoded filenames on source filesystem,
	use -input-charset to override.
mkisofs 2.01 (cpu-pc-linux-gnu)
Scanning /mnt/cdimages/CentOS-5.5-i386-tiny
Scanning /mnt/cdimages/CentOS-5.5-i386-tiny/images
. . .
Scanning /mnt/cdimages/CentOS-5.5-i386-tiny/isolinux
Excluded: /mnt/cdimages/CentOS-5.5-i386-tiny/isolinux/TRANS.TBL
Excluded by match: /mnt/cdimages/CentOS-5.5-i386-tiny/isolinux/boot.cat
Using RPM_G000.;1 for  /RPM-GPG-KEY-CentOS-5 (RPM-GPG-KEY-beta)
Using RELEA000.;1 for  /RELEASE-NOTES-cs (RELEASE-NOTES-nl)
. . . 
Using RELEA03R.HTM;1 for  /mnt/cdimages/CentOS-5.5-i386-tiny/NOTES/RELEASE-NOTES-U1-ta.html (RELEASE-NOTES-U4-ta.html)
Using RELEA03S.HTM;1 for  /mnt/cdimages/CentOS-5.5-i386-tiny/NOTES/RELEASE-NOTES-U4-ta.html (RELEASE-NOTES-U5-ko.html)
Writing:   Initial Padblock                        Start Block 0
Done with: Initial Padblock                        Block(s)    16
Writing:   Primary Volume Descriptor               Start Block 16
Done with: Primary Volume Descriptor               Block(s)    1
Writing:   Eltorito Volume Descriptor              Start Block 17
Size of boot image is 4 sectors -> No emulation
Done with: Eltorito Volume Descriptor              Block(s)    1
Writing:   Joliet Volume Descriptor                Start Block 18
Done with: Joliet Volume Descriptor                Block(s)    1
Writing:   End Volume Descriptor                   Start Block 19
Done with: End Volume Descriptor                   Block(s)    1
Writing:   Version block                           Start Block 20
Done with: Version block                           Block(s)    1
Writing:   Path table                              Start Block 21
Done with: Path table                              Block(s)    4
Writing:   Joliet path table                       Start Block 25
Done with: Joliet path table                       Block(s)    4
Writing:   Directory tree                          Start Block 29
Done with: Directory tree                          Block(s)    28
Writing:   Joliet directory tree                   Start Block 57
Done with: Joliet directory tree                   Block(s)    19
Writing:   Directory tree cleanup                  Start Block 76
Done with: Directory tree cleanup                  Block(s)    0
Writing:   Extension record                        Start Block 76
Done with: Extension record                        Block(s)    1
Writing:   The File(s)                             Start Block 77
  2.93% done, estimate finish Sat Dec 18 07:40:41 2010
  5.84% done, estimate finish Sat Dec 18 07:40:58 2010
. . .
 96.34% done, estimate finish Sat Dec 18 07:41:02 2010
 99.26% done, estimate finish Sat Dec 18 07:41:02 2010
Total translation table size: 47459
Total rockridge attributes bytes: 20211
Total directory bytes: 32768
Path table size(bytes): 98
Done with: The File(s)                             Block(s)    176518
Writing:   Ending Padblock                         Start Block 176581
Done with: Ending Padblock                         Block(s)    150
Max brk space used 41000
176731 extents written (345 MB)
[root@buildhost-32 CentOS-5.5-i386-tiny]# 

The resultant file size is just 346 MB:

[root@buildhost-32 CentOS-5.5-i386-tiny]# ls -lh /mnt/cdimages/CentOS-5.5-i386-tiny.iso 
-rw-r--r-- 1 107 107 346M Dec 18  2010 /mnt/cdimages/CentOS-5.5-i386-tiny.iso
[root@buildhost-32 CentOS-5.5-i386-tiny]#

Implant MD5SUM in the ISO file (optional)

The following will implant the ISO file's MD5 inside the ISO file itself.

[root@buildhost-32 CentOS-5.5-i386-tiny]# /usr/lib/anaconda-runtime/implantisomd5 $isofilename
Inserting md5sum into iso image...
md5 = 07924f0314ee1d8d638d6587a9602440
Inserting fragment md5sums into iso image...
fragmd5 = cf4f4baf62b2ca666e366f6382b44446572e596c94baddfdad66182455cb
frags = 20
Setting supported flag to 0
[root@buildhost-32 CentOS-5.5-i386-tiny]#

Test the stuff you just build (the bootable ISO image)

Now the Bootable-CD is created, as a result of last (mkisofs) step. I tested it to create a VM , on my Fedora 14 KVM host. It worked without a problem, in both text and GUI mode. Installed in 1 min 30 seconds! Consumes only 534 MB on the disk! Here are a few screen shots:-

File:Screenshot-centos-55-32-tiny-cd_Virtual_Machine-small.png


Note: Just press ENTER/OK on this (package selection) screen. File:Screenshot-centos-55-32-tiny-cd Virtual Machine-2-small.png


File:Screenshot-centos-55-32-tiny-cd Virtual Machine-3-small.png


By the way, the MD5SUM of this ISO is: a1c203b64d11981d1d2f74f18db2d710

DONE!

Personal tools