CentOS 5.5 x86 64 Hypervisor Edition (Minimal)

From WBITT's Cooker!

Revision as of 06:57, 30 May 2011 by Kamran (Talk | contribs)
Jump to: navigation, search

Author: Muhammad Kamran Azeem (kamran _at_ wbitt _dot_ com)

Created: 04 Jan 2011

Last Revised: (Please see the footer of this document)

Note: This custom CD now also includes packages needed to setup a web server.

It started, when I developed an itch to have a CENTOS 5.5 ServerCD, so I could setup my Physical and Vitual Machines, quickly. However CENTOS website does not provide one. It provides a live CD, which was of no use to me. And I was not in a mood (nor could afford) to download full 4.x GB of DVD. This desire to have a CENTOS ServerCD, changed to create a (minimalistic) Hypervisor CD, when I noticed RedHat's 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. If I can make such a CD / custom-distribution, I can use it to install the bare-minimum set of hypervisor packages (XEN or KVM) on my physical machines. Then, I can use the same CD to install a minimalistic (core) installation of a guest OS on the VMs I would create.

So, you can say, I was in competition with RedHat! :) I succeeded in my minimalistic Hypervisor approach (< 500MB), even if I got exceeded by a few (hundred) megabytes, compared to RedHat. Below is how I did it.

Note: You can refer to my other article Tiny CentOS 5.5 32 bit (i386), for more details and detailed steps. However, in this article, I have further simplified the steps. You no longer need to copy one RPM at a time to a temporary directory and test install it. Using "yumdownloader" is the easiest method. And the most important is that you no longer have to have a local repository of the full DVD. With the method below, you can pull everything directly from the internet. i.e. from the CENTOS websote (centos.org).

Contents

Benefits - Why a Hypervisor CD (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/volume would be needed to update all of the servers in your farm, compared to fat/thick installations.
  • Delivers you SSH and YUM, so you can add anything you want, on top of it.
  • Creates a very small (534 MB ~ 7504MB) foot print on the disk (depending on your package selection). 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).
  • Based on point above, 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 clusters of any size.
  • The same CD can be used to setup a XEN/KVM HyperVisor, and the same can be used to setup VMs, such as web/mail/db servers.

What does this CD provide

Although the actual CD is created in the steps listed farther below, still it would be appropriate to list it's key software packages.

  • YUM, wget, FTP client
  • VI editor (vim-minimal)
  • DHCP client
  • SSH Server and SSH client
  • SELinux
  • IP Tables
  • nmap, tcpdump, wireshark, iptraf, traceroute, etc.
  • XEN Hypervisor
  • KVM Hypervisor
  • virt-viewer, virt-manager
  • VNC Server
  • Basic X Window System with TWM (Tom's Window Manager) and XTERM
  • [Update: 19 March 2011] Additionally contains: Apache WebServer, PHP, MySQL, FTP, Postfix, SpamAssassin, Webalizer.

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-x86_64
│   ├── CentOS
│   ├── images
│   │   ├── pxeboot
│   │   └── xen
│   ├── isolinux
│   ├── NOTES
│   └── repodata
└── CentOS-5.5-x86_64-hypervisor

The /data/cdimages/CentOS-5.5-x86_64 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-x86_64-hypervisor directory shown above, is an empty directory. It is possible that you don't 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-64 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-64) is actually a CentOS 5.5 64 bit (x86_64) 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-64 ~]# yum -y install anaconda anaconda-runtime mkisofs cdrecord

The BuildHost has only 512 MB Virtual Memory, and 4GB Virtual Disk. We basically do not need much disk space on the build host. The space is needed to pull the RPMs using "yumdownloader" command. The BuildHost (VM) has the IP: 192.168.122.229, on its eth0 interface.

Steps

Make the repositories available on the buildhost-64

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-64 ~]# mkdir /mnt/cdimages

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

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

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

Create an empty directory CentOS-5.5-x86_64-hypervisor 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-64 ~]# mkdir /mnt/cdimages/CentOS-5.5-x86_64-hypervisor

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

[root@buildhost-64 ~]# rsync -av --exclude CentOS/  \
   /mnt/cdimages/CentOS-5.5-x86_64/   /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/

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-64 ~]# du -sh /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/
226M	/mnt/cdimages/CentOS-5.5-x86_64-hypervisor/

I created temporary directories named /tmp/transitRPMs and /tmp/RPMtest. /tmp/transitRPMs will hold the RPMs pulled by yumdownloader. /tmp/RPMtest will be used to test the RPMs. This is optional, because it doesn't make much sense after the packages are downloaded using yumdownloader, which checks for dependencies itself. Note: We cannot use directories created inside NFS mounts to use with RPM, or YUM, or YUMDOWNLOADER. Thus it is important to have a directory created on the local filesystem for both pulling the RPMs and testing them.

[root@buildhost-64 tmp]# mkdir /tmp/transitRPMs

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

Pulling the necessary RPMs

Note: The transitRPMs (or whatever name you chose for it), must not be on an NFS share. I found problems getting RPM and YUM to work inside NFS mounts.

[root@buildhost-64 tmp]# yum -y install yum-utils

Simple way to pull the the required RPM, along it's dependencies, is to use YUMDOWNLOADER (part of yum-utils package). The other (manual) method is to of-course copy the files one at a time, to the /tmp/transitRPMs directory. (Not very appealing of-course).

Here is how to pull just the kernel and all of it's related dependencies.

[root@buildhost-64 tmp]# yumdownloader  --destdir=/tmp/transitRPMs/  --installroot=/tmp/ --resolve kernel
. . . 
. . . 
--> Processing Dependency: libk5crypto.so.3()(64bit) for package: openssl
--> Running transaction check
---> Package krb5-libs.x86_64 0:1.6.1-36.el5_4.1 set to be updated
--> Processing Dependency: libkeyutils.so.1(KEYUTILS_0.3)(64bit) for package: krb5-libs
--> Processing Dependency: libkeyutils.so.1()(64bit) for package: krb5-libs
--> Running transaction check
---> Package keyutils-libs.x86_64 0:1.2-1.el5 set to be updated
--> Finished Dependency Resolution
. . . 
. . . 
kernel-2.6.18-194.el5.x86_64.rpm                                                                                                      |  19 MB     00:00     
device-mapper-multipath-0.4.7-34.el5.x86_64.rpm                                                                                       | 3.0 MB     00:00     
libsysfs-2.0.0-6.x86_64.rpm                                                                                                           |  45 kB     00:00     
iputils-20020927-46.el5.x86_64.rpm                                                                                                    | 131 kB     00:00     
libstdc++-4.1.2-48.el5.x86_64.rpm                                                                                                     | 352 kB     00:00     
libacl-2.2.39-6.el5.x86_64.rpm                                                                                                        |  19 kB     00:00     
libcap-1.10-26.x86_64.rpm                                                                                                             |  23 kB     00:00     
cpio-2.6-23.el5_4.1.x86_64.rpm                                                                                                        | 122 kB     00:00     
filesystem-2.4.0-3.el5.x86_64.rpm                                                                                                     | 1.0 MB     00:00     
nash-5.1.19.6-61.x86_64.rpm                                                                                                           | 1.1 MB     00:00     
binutils-2.17.50.0.6-14.el5.x86_64.rpm                                                                                                | 2.9 MB     00:00     
SysVinit-2.86-15.el5.x86_64.rpm                                                                                                       | 117 kB     00:00     
bash-3.2-24.el5.x86_64.rpm                                                                                                            | 1.9 MB     00:00     
libselinux-1.33.4-5.5.el5.x86_64.rpm                                                                                                  |  77 kB     00:00     
db4-4.3.29-10.el5.x86_64.rpm                                                                                                          | 898 kB     00:00     
[root@buildhost-64 tmp]# 
[root@buildhost-64 tmp]# ls /tmp/transitRPMs/*.rpm | wc -l
82

[root@buildhost-64 tmp]# du -sh /tmp/transitRPMs/ 
104M	/tmp/transitRPMs/

Of-course, the above is minimal most as it can get. It will give you a login prompt and shell access. But you won't have yum, wget, ftp, etc. And, you have to assign IP as well yourself. However this can be ideal for testing multiple machines, just to test availability over the network. But again, nothing fancy.

To get all the packages we need, for our "HypervisorEdition", below is what all I pulled.

[root@buildhost-64 ~]# yumdownloader  --disablerepo=\* --enablerepo=CentOS-5.6-i386  \
  --destdir=/tmp/transitRPMs/ \
  --installroot=/tmp/ \
  --resolve \
  kernel kernel-xen \
  vim-minimal wget yum dhclient grub rootfiles openssh-clients openssh-server passwd \
  iptables selinux-policy-targeted setools policycoreutils-newrole telnet tcpdump wireshark nmap star attr \
  zip bzip2 rsync which traceroute ftp vixie-cron iptraf sysklogd kudzu bind-utils \
  httpd php mysql-server postfix mod_ssl php-mysql mod_auth_mysql dovecot spamassassin squirrelmail \
  vsftpd xferstats elinks webalizer php-gd crypto-utils \
  xen kvm kvm-tools virt-viewer virt-manager \
  vnc-server xorg-x11-xinit xorg-x11-server-Xorg xorg-x11-twm xorg-x11-xdm bitmap-fonts desktop-backgrounds-basic \
  xorg-x11-drivers xorg-x11-fonts-75dpi xorg-x11-fonts-100dpi xorg-x11-fonts-ISO8859-1-75dpi xterm \
  xorg-x11-fonts-ISO8859-1-100dpi xorg-x11-fonts-misc xorg-x11-fonts-truetype xorg-x11-fonts-Type1

Note: The last two lines above provide additional RPMs for setting up web/mail/db servers.

The following information is about total number of RPMs and the space they consume on the installer media. Without webserver:

[root@buildhost-64 tmp]# ls /tmp/transitRPMs/*.rpm | wc -l
371

[root@buildhost-64 tmp]# du -sh  /tmp/transitRPMs/
275M	/tmp/transitRPMs/

With webserver:

[root@buildhost-64 CentOS]# ls |wc -l
430

[root@buildhost-64 CentOS]# du -sh .
318M	.

Test the installation of pulled RPMs (for the sake of completeness)

I use the testrun.sh script, shown in the scripts section below, to test the installation of RPMs, which were pulled just now using yumdownloader. You have to edit the script to specify correct locations of the RPMTEST variable.

[root@buildhost-64 tmp]# ./testrun.sh /tmp/transitRPMs/
warning: /tmp/transitRPMs//alsa-lib-1.0.17-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
[root@buildhost-64 tmp]# 

No errors here. This means that the test installation of the RPMs was successful. Good.

Synchronize the transitRPMs location with the build-tree

Once the test is successful, you can rsync this (transitRPMs) directory to your buildtree (/mnt/cdimages/CentOS-5.5-x86_64-hypervisor).

Create the CentOS directory in your build directory, if you have not created it already. It should be empty at this point.

[root@buildhost-64 tmp]# mkdir /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/CentOS

Now sync the directory.

[root@buildhost-64 tmp]# rsync -av --exclude var/  /tmp/transitRPMs/ /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/CentOS/
building file list ... done
. . . 
. . . 
xorg-x11-xinit-1.0.2-15.el5.x86_64.rpm
xorg-x11-xkb-utils-1.0.2-2.1.x86_64.rpm
xterm-215-8.el5_4.1.x86_64.rpm
xz-libs-4.999.9-0.3.beta.20091007git.el5.x86_64.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.x86_64.rpm
zip-2.31-2.el5.x86_64.rpm
zlib-1.2.3-3.x86_64.rpm

sent 284376910 bytes  received 8188 bytes  11607555.02 bytes/sec
total size is 284309498  speedup is 1.00
[root@buildhost-64 tmp]#

(Above is old output, but valid. You should see more bytes transferred, if you add web services).

Edit the comps.xml file as per requirements

I pulled a copy of original comps.xml from the original CENTOS repository. Removed all the "xml:lang" lines from it. Also removed all un-necessary groups and categories from it. Modified contents of the groups: core, base, xen and kvm. Below is the minimal version of comps.xml, for my CENTOS 5.5 64 bit Hypervisor Edition.

[root@buildhost-64 tmp]# cat comps.xml-hypervisor
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE newcomps PUBLIC "-//CentOS//DTD Comps info//EN" "comps.dtd">
<comps>

  <group>
    <id>base</id>
    <name>Base</name>
    <description>This group includes a minimal set of packages, inclusding X.</description>
    <default>false</default>
    <uservisible>true</uservisible>
    <packagelist>
      <packagereq type="default">vim-minimal</packagereq>
      <packagereq type="default">grub</packagereq>
      <packagereq type="default">openssh-clients</packagereq>
      <packagereq type="default">openssh-server</packagereq>
      <packagereq type="default">dhclient</packagereq>
      <packagereq type="default">rootfiles</packagereq>
      <packagereq type="default">iptables</packagereq>
      <packagereq type="optional">kernel-xen</packagereq>
      <packagereq type="default">telnet</packagereq>
      <packagereq type="default">tcpdump</packagereq>
      <packagereq type="default">nmap</packagereq>
      <packagereq type="optional">wireshark</packagereq>
      <packagereq type="default">zip</packagereq>
      <packagereq type="default">bzip2</packagereq>
      <packagereq type="default">rsync</packagereq>
      <packagereq type="default">which</packagereq>
      <packagereq type="default">traceroute</packagereq>
      <packagereq type="default">ftp</packagereq>
      <packagereq type="default">vixie-cron</packagereq>
      <packagereq type="optional">iptraf</packagereq>
      <packagereq type="default">setools</packagereq>
      <packagereq type="default">selinux-policy-targeted</packagereq>
      <packagereq type="default">selinux-policy</packagereq>
      <packagereq type="optional">vnc-server</packagereq>
      <packagereq type="optional">xterm</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-twm</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-xinit</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-xfs</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-server-utils</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-server-Xorg</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-xdm</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-drivers</packagereq>
      <packagereq type="conditional" requires="xterm">bitmap-fonts</packagereq>
      <packagereq type="conditional" requires="xterm">desktop-backgrounds-basic</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-fonts-75dpi</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-fonts-100dpi</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-fonts-ISO8859-1-75dpi</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-fonts-ISO8859-1-100dpi</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-fonts-misc</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-fonts-truetype</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-fonts-Type1</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-xauth</packagereq>
    </packagelist>
  </group>

  <group>
    <id>core</id>
    <name>Core</name>
    <description>Smallest 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">yum</packagereq>
      <packagereq type="mandatory">wget</packagereq>
      <packagereq type="mandatory">kudzu</packagereq>
    </packagelist>
  </group>

<group>
    <id>dns-server</id>
    <name>DNS Name Server</name>
    <description>This package group allows you to run a DNS name server (BIND) on the system.</description>
    <default>false</default>
    <uservisible>false</uservisible>
    <packagelist>
      <packagereq type="optional">vim-minimal</packagereq>
    </packagelist>
  </group>

  <group>
    <id>ftp-server</id>
    <name>FTP Server</name>
    <description>These tools allow you to run an FTP server on the system.</description>
    <default>false</default>
    <uservisible>true</uservisible>
    <packagelist>
      <packagereq type="default">vsftpd</packagereq>
      <packagereq type="optional">xferstats</packagereq>
    </packagelist>
  </group>

  <group>
    <id>legacy-network-server</id>
    <name>Legacy Network Server</name>
    <description>These packages include servers for old network protocols such as rsh and telnet.</description>
    <default>false</default>
    <uservisible>false</uservisible>
    <packagelist>
      <packagereq type="optional">vim-minimal</packagereq>
    </packagelist>
  </group>

  <group>
    <id>mail-server</id>
    <name>Mail Server</name>
    <description>These packages allow you to configure an IMAP or SMTP mail server.</description>
    <default>false</default>
    <uservisible>true</uservisible>
    <packagelist>
      <packagereq type="optional">dovecot</packagereq>
      <packagereq type="default">postfix</packagereq>
      <packagereq type="optional">spamassassin</packagereq>
      <packagereq type="optional">squirrelmail</packagereq>
    </packagelist>
  </group>

  <group>
    <id>mysql</id>
    <name>MySQL Database</name>
    <description>This package group contains packages useful for use with MySQL.</description>
    <default>false</default>
    <uservisible>true</uservisible>
    <packagelist>
      <packagereq type="mandatory">mysql</packagereq>
      <packagereq type="default">mysql-server</packagereq>
    </packagelist>
  </group>

  <group>
    <id>network-server</id>
    <name>Network Servers</name>
    <description>These packages include network-based servers such as DHCP, Kerberos and NIS.</description>
    <default>false</default>
    <uservisible>false</uservisible>
    <packagelist>
      <packagereq type="optional">vim-minimal</packagereq>
    </packagelist>
  </group>

  <group>
    <id>news-server</id>
    <name>News Server</name>
    <description>This group allows you to configure the system as a news server.</description>
    <default>false</default>
    <uservisible>false</uservisible>
    <packagelist>
      <packagereq type="optional">vim-minimal</packagereq>
    </packagelist>
  </group>

  <group>
    <id>printing</id>
    <name>Printing Support</name>
    <description>Install these tools to enable the system to print or act as a print server.</description>
    <default>false</default>
    <uservisible>false</uservisible>
    <packagelist>
      <packagereq type="optional">vim-minimal</packagereq>
    </packagelist>
  </group>

  <group>
    <id>sql-server</id>
    <name>PostgreSQL Database</name>
    <description>This package group includes packages useful for use with Postgresql.</description>
    <default>false</default>
    <uservisible>false</uservisible>
    <packagelist>
      <packagereq type="optional">vim-minimal</packagereq>
    </packagelist>
  </group>

  <group>
    <id>server-cfg</id>
    <name>Server Configuration Tools</name>
    <description>This group contains all of CentOS's custom server configuration tools.</description>
    <default>false</default>
    <uservisible>false</uservisible>
    <packagelist>
      <packagereq type="optional">vim-minimal</packagereq>
    </packagelist>
  </group>

  <group>
    <id>web-server</id>
    <name>Web Server</name>
    <description>These tools allow you to run a Web server on the system.</description>
    <default>true</default>
    <uservisible>true</uservisible>
    <packagelist>
      <packagereq type="conditional" requires="httpd">crypto-utils</packagereq>
      <packagereq type="conditional" requires="httpd">distcache</packagereq>
      <packagereq type="default">httpd</packagereq>
      <packagereq type="conditional" requires="httpd">mod_auth_mysql</packagereq>
      <packagereq type="conditional" requires="httpd">mod_ssl</packagereq>
      <packagereq type="default">php</packagereq>
      <packagereq type="conditional" requires="php">php-gd</packagereq>
      <packagereq type="conditional" requires="php">php-mysql</packagereq>
      <packagereq type="optional">webalizer</packagereq>
    </packagelist>
  </group>

  <group>
    <id>smb-server</id>
    <name>Windows File Server</name>
    <description>This package group allows you to share files between Linux and MS Windows(tm) systems.</description>
    <default>false</default>
    <uservisible>false</uservisible>
    <packagelist>
      <packagereq type="optional">vim-minimal</packagereq>
    </packagelist>
  </group>

  <group>
    <id>xen</id>
    <name>Virtualization</name>
    <description>Virtualization Support with XEN</description>
    <default>false</default>
    <uservisible>true</uservisible>
    <packagelist>
      <packagereq type="default">kernel-xen</packagereq>
      <packagereq type="optional">libvirt</packagereq>
      <packagereq type="default">xen</packagereq>
      <packagereq type="optional">virt-manager</packagereq>
      <packagereq type="optional">virt-viewer</packagereq>
    </packagelist>
  </group>

  <group>
    <id>kvm</id>
    <name>KVM</name>
    <description>Virtualization Support with KVM</description>
    <default>false</default>
    <uservisible>true</uservisible>
    <packagelist>
      <packagereq type='default'>celt051</packagereq>
      <packagereq type='default'>etherboot-zroms</packagereq>
      <packagereq type='default'>etherboot-zroms-kvm</packagereq>
      <packagereq type='default'>kmod-kvm</packagereq>
      <packagereq type='default'>kvm</packagereq>
      <packagereq type='default'>kvm-qemu-img</packagereq>
      <packagereq type='default'>log4cpp</packagereq>
      <packagereq type='default'>qcairo</packagereq>
      <packagereq type='default'>qffmpeg-libs</packagereq>
      <packagereq type='default'>qpixman</packagereq>
      <packagereq type='default'>qspice-libs</packagereq>
      <packagereq type='default'>libvirt</packagereq>
      <packagereq type='optional'>etherboot-pxes</packagereq>
      <packagereq type='optional'>etherboot-roms</packagereq>
      <packagereq type='optional'>etherboot-roms-kvm</packagereq>
      <packagereq type='optional'>iasl</packagereq>
      <packagereq type='optional'>kvm-tools</packagereq>
      <packagereq type="optional">virt-manager</packagereq>
      <packagereq type="optional">virt-viewer</packagereq>
    </packagelist>
  </group>

  <category>
    <id>base-system</id>
    <name>Base System</name>
    <description>Various core pieces of the system.</description>
    <display_order>92</display_order>
    <grouplist>
      <groupid>base</groupid>
    </grouplist>
  </category>

  <category>
    <id>servers</id>
    <name>Servers</name>
    <description>Software used for running network servers</description>
    <display_order>90</display_order>
    <grouplist>
      <groupid>web-server</groupid>
      <groupid>ftp-server</groupid>
      <groupid>mail-server</groupid>
      <groupid>mysql</groupid>
    </grouplist>
  </category>

  <category>
    <id>virtualization</id>
    <name>Virtualization</name>
    <description>Virtualization Support.</description>
    <display_order>93</display_order>
    <grouplist>
      <groupid>xen</groupid>
      <groupid>kvm</groupid>
    </grouplist>
  </category>
</comps>
[root@buildhost-64 tmp]#

You may want to run a sanity check on your comps.xml file. It will reveal any errors/typing mistakes, etc.

[root@buildhost-64 tmp]# xmllint --valid  comps.xml-hypervisor

Create the Repository

Use the script shown below in the scripts section to create the repository in your build directory. You have to edit the script to specify correct values for the variables used for COMPS.XML file.

[root@buildhost-64 tmp]# ./createrepo.sh /mnt/cdimages/CentOS-5.5-x86_64-hypervisor
Doing: rm -f /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/repodata/*
Doing: cp -v /tmp/comps.xml-hypervisor /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/repodata/comps.xml
`/tmp/comps.xml-hypervisor' -> `/mnt/cdimages/CentOS-5.5-x86_64-hypervisor/repodata/comps.xml'
Doing: createrepo -u media://1272326751.405938 -g /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/repodata/comps.xml /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/
430/430 - CentOS/libgnomeui-2.16.0-5.el5.x86_64.rpm                             
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@buildhost-64 tmp]# 

Build the ISO file out of your build-tree

Time for the final step. Build the ISO. Use the buildiso.sh script shown in the scripts section below, to create the ISO. You have to edit the script to specify location and name of the ISO file.

[root@buildhost-64 tmp]# ./buildiso.sh /mnt/cdimages/CentOS-5.5-x86_64-hypervisor
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-x86_64-hypervisor
Scanning /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/images
Scanning /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/images/pxeboot
Excluded: /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/images/pxeboot/TRANS.TBL
Scanning /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/images/xen
Excluded: /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/images/xen/TRANS.TBL
Excluded: /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/images/TRANS.TBL
Scanning /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/repodata
Excluded: /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/TRANS.TBL
Scanning /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/CentOS
Scanning /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/isolinux
Excluded: /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/isolinux/TRANS.TBL
Excluded by match: /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/isolinux/boot.cat
Using RPM_G000.;1 for  /RPM-GPG-KEY-CentOS-5 (RPM-GPG-KEY-beta)
Using RELEA000.;1 for  /RELEASE-NOTES-en (RELEASE-NOTES-en_US)
Using RELEA000.HTM;1 for  /RELEASE-NOTES-es.html (RELEASE-NOTES-en.html)
Using RELEA001.HTM;1 for  /RELEASE-NOTES-en.html (RELEASE-NOTES-en_US.html)
. . . 
. . . 
Using XORG_01V.RPM;1 for  /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/CentOS/xorg-x11-drv-digitaledge-1.1.0-1.1.x86_64.rpm (xorg-x11-drv-s3virge-1.9.1-2.1.x86_64.rpm)
Using XORG_01W.RPM;1 for  /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/CentOS/xorg-x11-drv-s3virge-1.9.1-2.1.x86_64.rpm (xorg-x11-fonts-75dpi-7.1-2.1.el5.noarch.rpm)
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:   Extension record                        Start Block 92
Done with: Extension record                        Block(s)    1
Writing:   The File(s)                             Start Block 93
  2.07% done, estimate finish Tue Jan  4 11:47:07 2011
  4.13% done, estimate finish Tue Jan  4 11:47:07 2011
  6.20% done, estimate finish Tue Jan  4 11:47:07 2011
  8.26% done, estimate finish Tue Jan  4 11:47:19 2011
 10.32% done, estimate finish Tue Jan  4 11:47:16 2011
. . . 
. . . 
 90.85% done, estimate finish Sat Mar 19 04:41:40 2011
 92.74% done, estimate finish Sat Mar 19 04:41:40 2011
 94.63% done, estimate finish Sat Mar 19 04:41:40 2011
 96.52% done, estimate finish Sat Mar 19 04:41:42 2011
 98.42% done, estimate finish Sat Mar 19 04:41:42 2011
Total translation table size: 118427
Total rockridge attributes bytes: 51139
Total directory bytes: 79872
Path table size(bytes): 98
Done with: The File(s)                             Block(s)    263941
Writing:   Ending Padblock                         Start Block 264041
Done with: Ending Padblock                         Block(s)    150
Max brk space used a0000
264191 extents written (515 MB)
[root@buildhost-64 tmp]#

Thats all. The ISO file is ready. Burn it on a CD, or use directly, or whatever suits you.

End of steps. The task of building the custom CENTOS ISO is successfully completed at this point.

Scripts used to test RPMs, create repo, and build ISO

testrun.sh (Used for testing a directory full of RPMs)

[root@buildhost-64 tmp]# cat testrun.sh 
#!/bin/bash
TESTDIR=$1
if [ "$TESTDIR" == "" ] ; then
  echo "You should provide the name of test directory containing RPMS. Please specify full path."
  exit 1
fi
RPMTEST="/tmp/RPMtest"
rpm --initdb --dbpath ${RPMTEST} 
rpm --test --dbpath ${RPMTEST} --root ${RPMTEST} -ivh ${TESTDIR}/*.rpm
[root@buildhost-64 tmp]# 

Usage:

[root@buildhost-64 tmp]# ./testrun.sh /tmp/transitRPMs
warning: /tmp/transitRPMs/alsa-lib-1.0.17-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
[root@buildhost-64 tmp]#

createrepo.sh (Used to create repository)

[root@buildhost-64 tmp]# cat createrepo.sh 
#!/bin/bash
BUILDDIR=$1
if [ "${BUILDDIR}" == "" ]; then
  echo "Build Directory cannot be empty. Please specify full path."
  exit 1
fi

COMPSFILE="/tmp/comps.xml-hypervisor"

export DISCINFO=$(head -1 ${BUILDDIR}/.discinfo)

echo "Doing: rm -f ${BUILDDIR}/repodata/*"
rm -f ${BUILDDIR}/repodata/* 

echo "Doing: cp -v ${COMPSFILE} ${BUILDDIR}/repodata/comps.xml"
cp -v ${COMPSFILE} ${BUILDDIR}/repodata/comps.xml 

echo "Doing: createrepo -u "media://${DISCINFO}" -g ${BUILDDIR}/repodata/comps.xml ${BUILDDIR}/"
createrepo  -u "media://${DISCINFO}" -g ${BUILDDIR}/repodata/comps.xml ${BUILDDIR}/
[root@buildhost-64 tmp]# 

Usage:

[root@buildhost-64 tmp]# ./createrepo.sh /mnt/cdimages/CentOS-5.5-x86_64-hypervisor
Doing: rm -f /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/repodata/*
Doing: cp -v /tmp/comps.xml-hypervisor /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/repodata/comps.xml
`/tmp/comps.xml-hypervisor' -> `/mnt/cdimages/CentOS-5.5-x86_64-hypervisor/repodata/comps.xml'
Doing: createrepo -u media://1272326751.405938 -g /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/repodata/comps.xml /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/
371/371 - CentOS/libgnomeui-2.16.0-5.el5.x86_64.rpm                             
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@buildhost-64 tmp]# 

buildiso.sh (Used to build the ISO file)

[root@buildhost-64 tmp]# cat buildiso.sh 
#!/bin/bash
BUILDDIR=$1
if [ "${BUILDDIR}" == "" ]; then
  echo "Build Directory cannot be empty. Please specify full path."
  exit 1
fi
ISODIR="/mnt/cdimages/"
ISOFILE="CentOS-5.5-x86_64-HypervisorEdition.iso"
READMEFILE="README.WBITT"
KICKSTARTFILE="sample-kickstart.ks"

# Remove the non-english RELEASE-NOTES. 
rm -f ${BUILDDIR}/RELEASE-NOTES-[a-d,f-z]*

# Remove NOTES directory, which contains RELEASE-NOTES in plethora of different languages.
rm -f ${BUILDDIR}/NOTES*

# Remove the target ISO file, if it already exists.
rm ${ISODIR}/${ISOFILE}


# [OPTIONAL] Create the README file in the CD root:
cp ${READMEFILE} ${BUILDDIR}/

# [OPTIONAL] Create a sample kickstart file in the CD root:
cp ${KICKSTARTFILE} ${BUILDDIR}/

# Finally, create the ISO.
mkisofs -r -R -J -T -v  \
   -no-emul-boot -boot-load-size 4 -boot-info-table \
   -V "CentOS-5.5-Hypervisor 64-bit" -p "KamranAzeem (kamran@wbitt.com)"  -A "CentOS-5.5-Hypervisor-Edition 64 bit-2011/01/03" \
   -b isolinux/isolinux.bin -c isolinux/boot.cat  -x "lost+found" \
   -o ${ISODIR}/${ISOFILE} ${BUILDDIR}

[root@buildhost-64 tmp]#

Usage:

[root@buildhost-64 tmp]# ./buildiso.sh /mnt/cdimages/CentOS-5.5-x86_64-hypervisor
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-x86_64-hypervisor
Scanning /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/images
Scanning /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/images/pxeboot
Excluded: /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/images/pxeboot/TRANS.TBL
Scanning /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/images/xen
Excluded: /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/images/xen/TRANS.TBL
Excluded: /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/images/TRANS.TBL
Scanning /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/repodata
Excluded: /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/TRANS.TBL
Scanning /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/CentOS
Scanning /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/isolinux
Excluded: /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/isolinux/TRANS.TBL
Excluded by match: /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/isolinux/boot.cat
Using RPM_G000.;1 for  /RPM-GPG-KEY-CentOS-5 (RPM-GPG-KEY-beta)
Using RELEA000.;1 for  /RELEASE-NOTES-en (RELEASE-NOTES-en_US)
Using RELEA000.HTM;1 for  /RELEASE-NOTES-es.html (RELEASE-NOTES-en.html)
Using RELEA001.HTM;1 for  /RELEASE-NOTES-en.html (RELEASE-NOTES-en_US.html)
. . . 
. . . 
Using XORG_01V.RPM;1 for  /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/CentOS/xorg-x11-drv-digitaledge-1.1.0-1.1.x86_64.rpm (xorg-x11-drv-s3virge-1.9.1-2.1.x86_64.rpm)
Using XORG_01W.RPM;1 for  /mnt/cdimages/CentOS-5.5-x86_64-hypervisor/CentOS/xorg-x11-drv-s3virge-1.9.1-2.1.x86_64.rpm (xorg-x11-fonts-75dpi-7.1-2.1.el5.noarch.rpm)
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:   Extension record                        Start Block 92
Done with: Extension record                        Block(s)    1
Writing:   The File(s)                             Start Block 93
  2.07% done, estimate finish Tue Jan  4 11:47:07 2011
  4.13% done, estimate finish Tue Jan  4 11:47:07 2011
  6.20% done, estimate finish Tue Jan  4 11:47:07 2011
  8.26% done, estimate finish Tue Jan  4 11:47:19 2011
 10.32% done, estimate finish Tue Jan  4 11:47:16 2011
. . . 
. . . 
 90.85% done, estimate finish Sat Mar 19 04:41:40 2011
 92.74% done, estimate finish Sat Mar 19 04:41:40 2011
 94.63% done, estimate finish Sat Mar 19 04:41:40 2011
 96.52% done, estimate finish Sat Mar 19 04:41:42 2011
 98.42% done, estimate finish Sat Mar 19 04:41:42 2011
Total translation table size: 118427
Total rockridge attributes bytes: 51139
Total directory bytes: 79872
Path table size(bytes): 98
Done with: The File(s)                             Block(s)    263941
Writing:   Ending Padblock                         Start Block 264041
Done with: Ending Padblock                         Block(s)    150
Max brk space used a0000
264191 extents written (515 MB)[root@buildhost-64 tmp]#

Screen Shots

File:Testhypervisor-PackageCategories.png

File:Testhypervisor-ServerPackages.png

File:Testhypervisor-VirtualizationPackages.png

File:Testhypervisor-PackageInstallation.png

Download the ISO (516 MB)

Version: 0.2

Built: 19 March 2011

Size: 516 MB

http://downloads.wbitt.com/isos

Check the download directory for MD5 and SHA1 checksums.

Personal tools