CentOS 5.5 i386 Webserver Edition (Minimal)

From WBITT's Cooker!

Revision as of 06:19, 10 January 2011 by Kamran (Talk | contribs)
Jump to: navigation, search

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.
  • Also provides PHP, MySQL server, so you can instantly setup and test your PHP based applications on a VM.

[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-webserver

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-webserver 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-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 (i386) 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 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.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             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-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-webserver 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-webserver

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-webserver/.

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

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-webserver/
226M	/mnt/cdimages/CentOS-5.5-i386-webserver/

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-32 tmp]# mkdir /tmp/transitRPMs

[root@buildhost-32 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-32 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-32 tmp]# yumdownloader  --destdir=/tmp/transitRPMs/  --installroot=/tmp/transitRPMs/ --resolve kernel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
local                                                                                                                                 | 1.1 kB     00:00     
local/primary                                                                                                                         | 920 kB     00:00     
local                                                                                                                                              2599/2599
--> Running transaction check
---> Package kernel.i686 0:2.6.18-194.el5 set to be installed
--> Processing Dependency: initscripts >= 8.11.1-1 for package: kernel
--> Processing Dependency: mkinitrd >= 4.2.21-1 for package: kernel
--> Processing Dependency: /bin/sh for package: kernel
--> Processing Dependency: module-init-tools for package: kernel
--> Processing Dependency: fileutils for package: kernel
--> Running transaction check
---> Package bash.i386 0:3.2-24.el5 set to be updated
--> Processing Dependency: libc.so.6(GLIBC_2.2) for package: bash
--> Processing Dependency: libc.so.6(GLIBC_2.3.4) for package: bash
. . . 
--> Processing Dependency: libkeyutils.so.1(KEYUTILS_0.3) for package: krb5-libs
--> Running transaction check
---> Package keyutils-libs.i386 0:1.2-1.el5 set to be updated
--> Finished Dependency Resolution
kernel-2.6.18-194.el5.i686.rpm                                                                                                        |  17 MB     00:00     
zlib-1.2.3-3.i386.rpm                                                                                                                 |  50 kB     00:00     
device-mapper-event-1.02.39-1.el5.i386.rpm                                                                                            |  20 kB     00:00     
nspr-4.7.6-1.el5_4.i386.rpm                                                                                                           | 119 kB     00:00    . . . 
. . . 
. . . 
. . . 
bzip2-libs-1.0.3-4.el5_2.i386.rpm                                                                                                     |  37 kB     00:00     
findutils-4.2.27-6.el5.i386.rpm                                                                                                       | 294 kB     00:00     
libstdc++-4.1.2-48.el5.i386.rpm                                                                                                       | 362 kB     00:00     
cpio-2.6-23.el5_4.1.i386.rpm   
[root@buildhost-32 tmp]# 
[root@buildhost-32 tmp]# ls /tmp/transitRPMs/*.rpm | wc -l
82

[root@buildhost-32 tmp]# du -sh  /tmp/transitRPMs/
98M	/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, with ping. But again, nothing fancy.

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

[root@buildhost-32 ~]# yumdownloader  --destdir=/tmp/transitRPMs/  --installroot=/tmp/transitRPMs/ --resolve kernel \ 
vim-minimal wget yum dhclient grub rootfiles openssh-clients openssh-server \ 
iptables selinux-policy-targeted setools kernel-xen telnet tcpdump wireshark nmap \ 
zip bzip2 rsync which traceroute ftp vixie-cron iptraf \ 
httpd php mysql-server postfix mod_ssl php-mysql mod_auth_mysql dovecot spamassassin squirrelmail \ 
vsftpd xferstats elinks webalizer php-gd crypto-utils
[root@buildhost-32 tmp]# ls /tmp/transitRPMs/*.rpm | wc -l
211

[root@buildhost-32 tmp]# du -sh /tmp/transitRPMs/
250M	/tmp/transitRPMs/

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-32 tmp]# ./testrun.sh /tmp/transitRPMs/
warning: /tmp/transitRPMs//apr-1.2.7-11.el5_3.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
[root@buildhost-32 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-i386-webserver).

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

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

Now sync the directory.

[root@buildhost-32 tmp]# rsync -av webserver/ /mnt/cdimages/CentOS-5.5-i386-webserver/CentOS/
building file list ... done
./
MAKEDEV-3.23-1.2.i386.rpm
SysVinit-2.86-15.el5.i386.rpm
apr-1.2.7-11.el5_3.1.i386.rpm
apr-util-1.2.7-11.el5.i386.rpm
aspell-0.60.3-7.1.i386.rpm
. . . 
. . . 
yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
zip-2.31-2.el5.i386.rpm
zlib-1.2.3-3.i386.rpm

sent 261452566 bytes  received 5024 bytes  14132842.70 bytes/sec
total size is 261401513  speedup is 1.00
[root@buildhost-32 tmp]#

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.

Note: When you edit this file, you will need to keep note of few things. [Needs update]. comps.xml groups and categories , and the titles shown during the installer / packages selection screen are two different things. I had to fool the installer , by retaining most of the "server" groups (filled with a simple vim-minimal package) in comps.xml . This was the only method I found out, to be able to show "Server" on the package selection screen. More on this later.

[root@buildhost-32 tmp]# cat comps.xml-webserver
<?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. Useful for creating small router/firewall boxes, for example.</description>
    <default>true</default>
    <uservisible>true</uservisible>
    <packagelist>
      <packagereq type="default">bzip2</packagereq>
      <packagereq type="default">dhclient</packagereq>
      <packagereq type="default">elinks</packagereq>
      <packagereq type="default">ftp</packagereq>
      <packagereq type="default">grub</packagereq>
      <packagereq type="default">iptables</packagereq>
      <packagereq type="optional">iptraf</packagereq>
      <packagereq type="optional">kernel-xen</packagereq>
      <packagereq type="default">nmap</packagereq>
      <packagereq type="default">openssh-clients</packagereq>
      <packagereq type="default">openssh-server</packagereq>
      <packagereq type="default">rootfiles</packagereq>
      <packagereq type="default">rsync</packagereq>
      <packagereq type="default">selinux-policy</packagereq>
      <packagereq type="default">selinux-policy-targeted</packagereq>
      <packagereq type="default">setools</packagereq>
      <packagereq type="default">tcpdump</packagereq>
      <packagereq type="default">telnet</packagereq>
      <packagereq type="default">traceroute</packagereq>
      <packagereq type="default">vim-minimal</packagereq>
      <packagereq type="default">vixie-cron</packagereq>
      <packagereq type="default">which</packagereq>
      <packagereq type="optional">wireshark</packagereq>
      <packagereq type="default">zip</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">centos-release-notes</packagereq>
      <packagereq type="mandatory">coreutils</packagereq>
      <packagereq type="mandatory">cpio</packagereq>
      <packagereq type="mandatory">e2fsprogs</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">redhat-logos</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">wget</packagereq>
      <packagereq type="mandatory">yum</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>

  <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>
</comps>
[root@buildhost-32 tmp]# 

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

[root@buildhost-32 tmp]# xmllint --valid  comps.xml-webserver

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-32 tmp]# ./createrepo.sh  /mnt/cdimages/CentOS-5.5-i386-webserver
Doing: rm -f /mnt/cdimages/CentOS-5.5-i386-webserver/repodata/*
Doing: cp -v /tmp/comps.xml-webserver /mnt/cdimages/CentOS-5.5-i386-webserver/repodata/comps.xml
`/tmp/comps.xml-webserver' -> `/mnt/cdimages/CentOS-5.5-i386-webserver/repodata/comps.xml'
Doing: createrepo -u media://1272587247.016243 -g /mnt/cdimages/CentOS-5.5-i386-webserver/repodata/comps.xml /mnt/cdimages/CentOS-5.5-i386-webserver/
211/211 - CentOS/fipscheck-lib-1.2.0-1.el5.i386.rpm                             
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@buildhost-32 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-32 tmp]# ./buildiso.sh  /mnt/cdimages/CentOS-5.5-i386-webserver
rm: cannot remove `/mnt/cdimages//CentOS-5.5-i386-WebserverEdition.iso': No such file or directory
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-webserver
Scanning /mnt/cdimages/CentOS-5.5-i386-webserver/images
Scanning /mnt/cdimages/CentOS-5.5-i386-webserver/CentOS
Scanning /mnt/cdimages/CentOS-5.5-i386-webserver/isolinux
Excluded: /mnt/cdimages/CentOS-5.5-i386-webserver/isolinux/TRANS.TBL
Excluded by match: /mnt/cdimages/CentOS-5.5-i386-webserver/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)
. . . 
. . . 
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:   Joliet directory tree                   Start Block 53
Done with: Joliet directory tree                   Block(s)    17
Writing:   Directory tree cleanup                  Start Block 70
Done with: Directory tree cleanup                  Block(s)    0
Writing:   Extension record                        Start Block 70
Done with: Extension record                        Block(s)    1
Writing:   The File(s)                             Start Block 71
  2.34% done, estimate finish Wed Jan  5 12:22:39 2011
  4.68% done, estimate finish Wed Jan  5 12:22:18 2011
  7.02% done, estimate finish Wed Jan  5 12:22:11 2011
. . . 
. . . 
 91.23% done, estimate finish Wed Jan  5 12:22:23 2011
 93.57% done, estimate finish Wed Jan  5 12:22:22 2011
 95.90% done, estimate finish Wed Jan  5 12:22:22 2011
 98.24% done, estimate finish Wed Jan  5 12:22:24 2011
Total translation table size: 64086
Total rockridge attributes bytes: 27318
Total directory bytes: 45056
Path table size(bytes): 98
Done with: The File(s)                             Block(s)    213539
Writing:   Ending Padblock                         Start Block 213610
Done with: Ending Padblock                         Block(s)    150
Max brk space used 3f000
213760 extents written (417 MB)
[root@buildhost-32 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-32 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-32 tmp]# 

Usage:

[root@buildhost-32 tmp]# ./testrun.sh webserver/
warning: webserver//apr-1.2.7-11.el5_3.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
[root@buildhost-32 tmp]# 

createrepo.sh (Used to create repository)

[root@buildhost-32 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-webserver"

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-32 tmp]# 

Usage:

[root@buildhost-32 tmp]# ./createrepo.sh /mnt/cdimages/CentOS-5.5-i386-webserver
Doing: rm -f /mnt/cdimages/CentOS-5.5-i386-webserver/repodata/*
Doing: cp -v /tmp/comps.xml-webserver /mnt/cdimages/CentOS-5.5-i386-webserver/repodata/comps.xml
`/tmp/comps.xml-webserver' -> `/mnt/cdimages/CentOS-5.5-i386-webserver/repodata/comps.xml'
Doing: createrepo -u media://1272587247.016243 -g /mnt/cdimages/CentOS-5.5-i386-webserver/repodata/comps.xml /mnt/cdimages/CentOS-5.5-i386-webserver/
211/211 - CentOS/fipscheck-lib-1.2.0-1.el5.i386.rpm                             
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@buildhost-32 tmp]#

buildiso.sh (Used to build the ISO file)

[root@buildhost-32 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-i386-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-Webserver 32-bit" -p "KamranAzeem (kamran@wbitt.com)"  -A "CentOS-5.5-Webserver-Edition 32 bit-2011/01/08" \
   -b isolinux/isolinux.bin -c isolinux/boot.cat  -x "lost+found" \
   -o ${ISODIR}/${ISOFILE} ${BUILDDIR}

[root@buildhost-32 tmp]#

Usage:

[root@buildhost-32 tmp]# ./buildiso.sh  /mnt/cdimages/CentOS-5.5-i386-webserver
rm: cannot remove `/mnt/cdimages//CentOS-5.5-i386-WebserverEdition.iso': No such file or directory
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-webserver
Scanning /mnt/cdimages/CentOS-5.5-i386-webserver/images
Scanning /mnt/cdimages/CentOS-5.5-i386-webserver/CentOS
Scanning /mnt/cdimages/CentOS-5.5-i386-webserver/isolinux
Excluded: /mnt/cdimages/CentOS-5.5-i386-webserver/isolinux/TRANS.TBL
Excluded by match: /mnt/cdimages/CentOS-5.5-i386-webserver/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)
. . . 
. . . 
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:   Joliet directory tree                   Start Block 53
Done with: Joliet directory tree                   Block(s)    17
Writing:   Directory tree cleanup                  Start Block 70
Done with: Directory tree cleanup                  Block(s)    0
Writing:   Extension record                        Start Block 70
Done with: Extension record                        Block(s)    1
Writing:   The File(s)                             Start Block 71
  2.34% done, estimate finish Wed Jan  5 12:22:39 2011
  4.68% done, estimate finish Wed Jan  5 12:22:18 2011
  7.02% done, estimate finish Wed Jan  5 12:22:11 2011
. . . 
. . . 
 91.23% done, estimate finish Wed Jan  5 12:22:23 2011
 93.57% done, estimate finish Wed Jan  5 12:22:22 2011
 95.90% done, estimate finish Wed Jan  5 12:22:22 2011
 98.24% done, estimate finish Wed Jan  5 12:22:24 2011
Total translation table size: 64086
Total rockridge attributes bytes: 27318
Total directory bytes: 45056
Path table size(bytes): 98
Done with: The File(s)                             Block(s)    213539
Writing:   Ending Padblock                         Start Block 213610
Done with: Ending Padblock                         Block(s)    150
Max brk space used 3f000
213760 extents written (417 MB)
[root@buildhost-32 tmp]#

Complete list of RPMS (for our CENTOS 5.5 i386 Webserver Edition)

[root@buildhost-32 tmp]# ls webserver/*.rpm | wc -l
211

[root@buildhost-32 tmp]# du -sh webserver/
250M	webserver/
[root@buildhost-32 tmp]# ls -tr1 webserver/*.rpm
perl-Archive-Tar-1.30-1.fc6.noarch.rpm
perl-libwww-perl-5.805-1.1.1.noarch.rpm
perl-IO-Zlib-1.04-4.2.1.noarch.rpm
perl-IO-Socket-SSL-1.01-1.fc6.noarch.rpm
perl-IO-Socket-INET6-2.51-2.fc6.noarch.rpm
perl-HTML-Tagset-3.10-2.1.1.noarch.rpm
perl-HTML-Parser-3.55-1.fc6.i386.rpm
perl-Digest-SHA1-2.11-1.2.1.i386.rpm
perl-Digest-HMAC-1.01-15.noarch.rpm
perl-Compress-Zlib-1.42-1.fc6.i386.rpm
perl-URI-1.35-3.noarch.rpm
perl-Socket6-0.19-3.fc6.i386.rpm
perl-Net-SSLeay-1.30-4.fc6.i386.rpm
perl-Net-IP-1.25-2.fc6.noarch.rpm
perl-Net-DNS-0.59-3.el5.i386.rpm
procmail-3.22-17.1.el5.centos.i386.rpm
python-sqlite-1.1.7-1.2.1.i386.rpm
python-elementtree-1.2.6-5.i386.rpm
rootfiles-8.1-1.1.1.noarch.rpm
rsync-2.6.8-3.1.i386.rpm
sed-4.1.5-5.fc6.i386.rpm
setools-3.0-3.el5.i386.rpm
slang-2.0.6-4.el5.i386.rpm
termcap-5.5-1.20060701.1.noarch.rpm
webalizer-2.01_10-30.1.i386.rpm
which-2.16-7.i386.rpm
xferstats-2.16-14.1.i386.rpm
xorg-x11-filesystem-7.1-2.fc6.noarch.rpm
zlib-1.2.3-3.i386.rpm
MAKEDEV-3.23-1.2.i386.rpm
aspell-0.60.3-7.1.i386.rpm
aspell-en-6.0-2.1.i386.rpm
basesystem-8.0-5.1.1.el5.centos.noarch.rpm
crontabs-1.10-8.noarch.rpm
distcache-1.4.5-14.1.i386.rpm
gawk-3.1.5-14.el5.i386.rpm
gdbm-1.8.0-26.2.1.i386.rpm
gmp-4.1.4-10.el5.i386.rpm
info-4.8-14.el5.i386.rpm
iptraf-3.0.0-5.el5.i386.rpm
keyutils-libs-1.2-1.el5.i386.rpm
libXpm-3.5.5-3.i386.rpm
libXdmcp-1.0.1-2.1.i386.rpm
libXau-1.0.1-3.1.i386.rpm
libattr-2.4.32-1.1.i386.rpm
libcap-1.10-26.i386.rpm
libgpg-error-1.4-2.i386.rpm
libjpeg-6b-37.i386.rpm
libidn-0.6.5-1.1.i386.rpm
libtermcap-2.0.8-46.1.i386.rpm
libsysfs-2.0.0-6.i386.rpm
libusb-0.1.12-5.1.i386.rpm
mailcap-2.1.23-1.fc6.noarch.rpm
mktemp-1.5-23.2.2.i386.rpm
mingetty-1.07-5.2.2.i386.rpm
ncurses-5.5-24.20060715.i386.rpm
nmap-4.11-1.1.i386.rpm
cracklib-2.8.9-3.3.i386.rpm
cracklib-dicts-2.8.9-3.3.i386.rpm
newt-perl-1.08-9.2.2.i386.rpm
telnet-0.17-39.el5.i386.rpm
pcre-6.6-2.el5_1.7.i386.rpm
fontconfig-2.4.1-7.el5.i386.rpm
crypto-utils-2.3-2.el5.i386.rpm
diffutils-2.8.1-15.2.3.el5.i386.rpm
libsmi-0.4.5-2.el5.i386.rpm
pkgconfig-0.21-2.el5.i386.rpm
python-iniparse-0.2.3-4.el5.noarch.rpm
postfix-2.3.3-2.1.el5_2.i386.rpm
bzip2-libs-1.0.3-4.el5_2.i386.rpm
bzip2-1.0.3-4.el5_2.i386.rpm
bash-3.2-24.el5.i386.rpm
dovecot-1.0.7-7.el5.i386.rpm
elfutils-libelf-0.137-3.el5.i386.rpm
ftp-0.17-35.el5.i386.rpm
gnupg-1.4.5-14.i386.rpm
logrotate-3.7.4-9.i386.rpm
mcstrans-0.2.11-3.el5.i386.rpm
perl-DBI-1.52-2.el5.i386.rpm
perl-DBD-MySQL-3.0007-2.el5.i386.rpm
python-urlgrabber-3.1.0-5.el5.noarch.rpm
sgpio-1.2.0_10-2.el5.i386.rpm
spamassassin-3.2.5-1.el5.i386.rpm
tmpwatch-2.9.7-1.1.el5.2.i386.rpm
SysVinit-2.86-15.el5.i386.rpm
traceroute-2.0.1-5.el5.i386.rpm
zip-2.31-2.el5.i386.rpm
redhat-logos-4.9.99-11.el5.centos.noarch.rpm
glib2-2.12.3-4.el5_3.1.i386.rpm
mod_auth_mysql-3.0.0-3.2.el5_3.i386.rpm
libpng-1.2.10-7.1.el5_3.2.i386.rpm
file-4.17-15.el5_3.1.i386.rpm
freetype-2.2.1-21.el5_3.i386.rpm
wireshark-1.0.8-1.el5_3.1.i386.rpm
nss-3.12.3.99.3-1.el5.centos.2.i386.rpm
apr-1.2.7-11.el5_3.1.i386.rpm
libxml2-2.6.26-2.1.2.8.i386.rpm
gnutls-1.4.1-3.el5_3.5.i386.rpm
db4-4.3.29-10.el5.i386.rpm
e2fsprogs-1.39-23.el5.i386.rpm
e2fsprogs-libs-1.39-23.el5.i386.rpm
fipscheck-1.2.0-1.el5.i386.rpm
findutils-4.2.27-6.el5.i386.rpm
fipscheck-lib-1.2.0-1.el5.i386.rpm
grub-0.97-13.5.i386.rpm
libgcrypt-1.4.4-5.el5.i386.rpm
libsemanage-1.9.1-4.4.el5.i386.rpm
libselinux-utils-1.33.4-5.5.el5.i386.rpm
libselinux-python-1.33.4-5.5.el5.i386.rpm
libselinux-1.33.4-5.5.el5.i386.rpm
libX11-1.0.3-11.el5.i386.rpm
m2crypto-0.16-6.el5.6.i386.rpm
perl-5.8.8-27.el5.i386.rpm
rpm-4.4.2.3-18.el5.i386.rpm
python-2.4.3-27.el5.i386.rpm
popt-1.10.2.3-18.el5.i386.rpm
rpm-python-4.4.2.3-18.el5.i386.rpm
rpm-libs-4.4.2.3-18.el5.i386.rpm
sqlite-3.3.6-5.i386.rpm
tcl-8.4.13-4.el5.i386.rpm
vim-minimal-7.0.109-6.el5.i386.rpm
udev-095-14.21.el5.i386.rpm
yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
iputils-20020927-46.el5.i386.rpm
grep-2.5.1-55.el5.i386.rpm
tcp_wrappers-7.6-40.7.el5.i386.rpm
setup-2.5.58-7.el5.noarch.rpm
readline-5.1-3.el5.i386.rpm
psmisc-22.2-7.i386.rpm
initscripts-8.45.30-2.el5.centos.i386.rpm
postgresql-libs-8.1.18-2.el5_4.1.i386.rpm
squirrelmail-1.4.8-5.el5.centos.10.noarch.rpm
elinks-0.11.1-6.el5_4.1.i386.rpm
nspr-4.7.6-1.el5_4.i386.rpm
iptables-1.3.5-5.3.el5_4.1.i386.rpm
wget-1.11.4-2.el5_4.1.i386.rpm
expat-1.95.8-8.3.el5_4.2.i386.rpm
vsftpd-2.0.5-16.el5_4.1.i386.rpm
gd-2.0.33-9.4.el5_4.2.i386.rpm
vixie-cron-4.1-77.el5_4.1.i386.rpm
krb5-libs-1.6.1-36.el5_4.1.i386.rpm
yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
util-linux-2.13-0.52.el5_4.1.i386.rpm
gzip-1.3.5-11.el5.centos.1.i386.rpm
coreutils-5.97-23.el5_4.2.i386.rpm
mysql-5.0.77-4.el5_4.2.i386.rpm
mysql-server-5.0.77-4.el5_4.2.i386.rpm
pam-0.99.6.2-6.el5_4.1.i386.rpm
tzdata-2010e-1.el5.noarch.rpm
cpio-2.6-23.el5_4.1.i386.rpm
cyrus-sasl-lib-2.1.22-5.el5_4.3.i386.rpm
cyrus-sasl-2.1.22-5.el5_4.3.i386.rpm
openssl-0.9.8e-12.el5_4.6.i686.rpm
yum-3.2.22-26.el5.centos.noarch.rpm
audit-libs-python-1.7.17-3.el5.i386.rpm
audit-libs-1.7.17-3.el5.i386.rpm
apr-util-1.2.7-11.el5.i386.rpm
centos-release-notes-5.5-0.i386.rpm
centos-release-5-5.el5.centos.i386.rpm
binutils-2.17.50.0.6-14.el5.i386.rpm
curl-7.15.5-9.el5.i386.rpm
chkconfig-1.3.30.2-2.el5.i386.rpm
checkpolicy-1.33.1-6.el5.i386.rpm
dmraid-events-1.0.0.rc13-63.el5.i386.rpm
dmraid-1.0.0.rc13-63.el5.i386.rpm
dhclient-3.0.5-23.el5.i386.rpm
device-mapper-multipath-0.4.7-34.el5.i386.rpm
device-mapper-event-1.02.39-1.el5.i386.rpm
device-mapper-1.02.39-1.el5.i386.rpm
filesystem-2.4.0-3.el5.i386.rpm
ethtool-6-4.el5.i386.rpm
glibc-common-2.5-49.i386.rpm
glibc-2.5-49.i686.rpm
httpd-2.2.3-43.el5.centos.i386.rpm
hmaccalc-0.9.6-3.el5.i386.rpm
kernel-2.6.18-194.el5.i686.rpm
iproute-2.6.18-11.el5.i386.rpm
libacl-2.2.39-6.el5.i386.rpm
less-436-2.el5.i386.rpm
kpartx-0.4.7-34.el5.i386.rpm
kernel-xen-2.6.18-194.el5.i686.rpm
libgcc-4.1.2-48.el5.i386.rpm
libsepol-1.15.2-3.el5.i386.rpm
libpcap-0.9.4-15.el5.i386.rpm
libstdc++-4.1.2-48.el5.i386.rpm
lvm2-2.02.56-8.el5.i386.rpm
module-init-tools-3.3-0.pre3.1.60.el5.i386.rpm
mod_ssl-2.2.3-43.el5.centos.i386.rpm
mkinitrd-5.1.19.6-61.i386.rpm
net-tools-1.60-81.el5.i386.rpm
nash-5.1.19.6-61.i386.rpm
openldap-2.3.43-12.el5.i386.rpm
newt-0.52.2-15.el5.i386.rpm
openssh-server-4.3p2-41.el5.i386.rpm
openssh-clients-4.3p2-41.el5.i386.rpm
openssh-4.3p2-41.el5.i386.rpm
php-gd-5.1.6-27.el5.i386.rpm
php-common-5.1.6-27.el5.i386.rpm
php-cli-5.1.6-27.el5.i386.rpm
php-5.1.6-27.el5.i386.rpm
policycoreutils-1.33.12-14.8.el5.i386.rpm
php-pdo-5.1.6-27.el5.i386.rpm
php-mysql-5.1.6-27.el5.i386.rpm
php-mbstring-5.1.6-27.el5.i386.rpm
rsyslog-3.22.1-3.el5.i386.rpm
procps-3.2.7-16.el5.i386.rpm
shadow-utils-4.0.17-15.el5.i386.rpm
selinux-policy-targeted-2.4.6-279.el5.noarch.rpm
selinux-policy-2.4.6-279.el5.noarch.rpm
tcpdump-3.9.4-15.el5.i386.rpm
tar-1.15.1-30.el5.i386.rpm
[root@buildhost-32 tmp]#

Screen Shots

File:Test-webserver-1.png

File:Test-webserver-2.png

File:Test-webserver-3.png

File:Test-webserver-4.png

File:Test-webserver-5.png

Download the ISO (418 MB)

Built on 08 Jan 2011 . http://downloads.wbitt.com/downloads/CentOS-5.5-i386-WebserverEdition.iso (418 MB)

MD5SUM : 968c6074c6b7655d5d10a408c7270846

SHA1SUM: 401c47974b688861d9f5e676deba5b909c80ce20

Personal tools