Tiny CentOS 5.5 32 bit (i386)
From WBITT's Cooker!
(→Make the repositories available on the buildhost) |
|||
Line 115: | Line 115: | ||
</pre> | </pre> | ||
+ | Copy one file at a time to the /tmp/rpms directory: | ||
+ | <pre> | ||
- | + | [root@buildhost tmp]# cp /mnt/cdimages/CentOS-5.5-i386/CentOS/kernel-2.6.18-194.el5.i686.rpm \ | |
+ | /tmp/rpms/ | ||
+ | </pre> | ||
+ | |||
+ | Used the following two commands to test install the rpms I placed in /tmp/rpms/ directory. | ||
+ | |||
+ | <pre> | ||
+ | rpm --initdb --dbpath /tmp/RPMtest/ | ||
+ | rpm --test --dbpath /tmp/RPMtest/ -ivh /tmp/rpms/*.rpm | ||
+ | </pre> | ||
+ | |||
+ | Then, I created the following script, containing the same two lines to test-install the RPMs. | ||
<pre> | <pre> | ||
[root@buildhost tmp]# cat testrun.sh | [root@buildhost tmp]# cat testrun.sh |
Revision as of 10:22, 17 December 2010
Contents |
Summary
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).
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.
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. 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
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 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 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 ~]# 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
See if you are able to view the NFS share made available on the physical host.
[root@buildhost ~]# 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 ~]# mkdir /mnt/cdimages [root@buildhost ~]# mount -t nfs 192.168.122.1:/data/cdimages/ /mnt/cdimages/ [root@buildhost ~]# 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 ~]#
As you can see, the /data/cdimages from the physical host is now available on our buildhost, 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 ~]# 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 ~]# 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 ~]# du -sh /mnt/cdimages/CentOS-5.5-i386-tiny/ 226M /mnt/cdimages/CentOS-5.5-i386-tiny/ [root@buildhost ~]#
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 tmp]# mkdir /tmp/rpms [root@buildhost tmp]# mkdir /tmp/RPMtest
Copy one file at a time to the /tmp/rpms directory:
[root@buildhost 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
Then, I created the following script, containing the same two lines to test-install the RPMs.
[root@buildhost tmp]# cat testrun.sh #!/bin/bash rpm --initdb --dbpath /tmp/RPMtest/ rpm --test --dbpath /tmp/RPMtest/ -ivh /tmp/rpms/*.rpm [root@buildhost rpms]#
Here are the basic stats:
Total packages and size of the RPMs alone:
[root@buildhost tmp]# ls -l /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/ | wc -l 110 Actually 108 packages. (Need to exclude . and .. directories from the list above) [root@buildhost tmp]# du -sh /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/ 124M /mnt/cdimages/CentOS-5.5-i386-tiny/CentOS/
Includes ssh-server, wget and yum:
[root@vm2 centos-micro]# ls -1 | sort audit-libs-1.7.17-3.el5.x86_64.rpm basesystem-8.0-5.1.1.el5.centos.noarch.rpm bash-3.2-24.el5.x86_64.rpm binutils-2.17.50.0.6-14.el5.x86_64.rpm bzip2-libs-1.0.3-4.el5_2.x86_64.rpm centos-release-5-5.el5.centos.x86_64.rpm centos-release-notes-5.5-0.x86_64.rpm chkconfig-1.3.30.2-2.el5.x86_64.rpm coreutils-5.97-23.el5_4.2.x86_64.rpm cpio-2.6-23.el5_4.1.x86_64.rpm cracklib-2.8.9-3.3.x86_64.rpm cracklib-dicts-2.8.9-3.3.x86_64.rpm crontabs-1.10-8.noarch.rpm db4-4.3.29-10.el5.x86_64.rpm device-mapper-1.02.39-1.el5.x86_64.rpm device-mapper-event-1.02.39-1.el5.x86_64.rpm device-mapper-multipath-0.4.7-34.el5.x86_64.rpm dmraid-1.0.0.rc13-63.el5.x86_64.rpm dmraid-events-1.0.0.rc13-63.el5.x86_64.rpm e2fsprogs-1.39-23.el5.x86_64.rpm e2fsprogs-libs-1.39-23.el5.x86_64.rpm elfutils-libelf-0.137-3.el5.x86_64.rpm ethtool-6-4.el5.x86_64.rpm expat-1.95.8-8.3.el5_4.2.x86_64.rpm filesystem-2.4.0-3.el5.x86_64.rpm findutils-4.2.27-6.el5.x86_64.rpm fipscheck-1.2.0-1.el5.x86_64.rpm fipscheck-lib-1.2.0-1.el5.x86_64.rpm gawk-3.1.5-14.el5.x86_64.rpm gdbm-1.8.0-26.2.1.x86_64.rpm glib2-2.12.3-4.el5_3.1.x86_64.rpm glibc-2.5-49.x86_64.rpm glibc-common-2.5-49.x86_64.rpm grep-2.5.1-55.el5.x86_64.rpm gzip-1.3.5-11.el5.centos.1.x86_64.rpm hmaccalc-0.9.6-3.el5.x86_64.rpm info-4.8-14.el5.x86_64.rpm initscripts-8.45.30-2.el5.centos.x86_64.rpm iproute-2.6.18-11.el5.x86_64.rpm iputils-20020927-46.el5.x86_64.rpm kernel-2.6.18-194.el5.x86_64.rpm keyutils-libs-1.2-1.el5.x86_64.rpm kpartx-0.4.7-34.el5.x86_64.rpm krb5-libs-1.6.1-36.el5_4.1.x86_64.rpm less-436-2.el5.x86_64.rpm libacl-2.2.39-6.el5.x86_64.rpm libattr-2.4.32-1.1.x86_64.rpm libcap-1.10-26.x86_64.rpm libgcc-4.1.2-48.el5.x86_64.rpm libselinux-1.33.4-5.5.el5.x86_64.rpm libsepol-1.15.2-3.el5.x86_64.rpm libstdc++-4.1.2-48.el5.x86_64.rpm libsysfs-2.0.0-6.x86_64.rpm libtermcap-2.0.8-46.1.x86_64.rpm libxml2-2.6.26-2.1.2.8.x86_64.rpm logrotate-3.7.4-9.x86_64.rpm lvm2-2.02.56-8.el5.x86_64.rpm m2crypto-0.16-6.el5.6.x86_64.rpm MAKEDEV-3.23-1.2.x86_64.rpm mcstrans-0.2.11-3.el5.x86_64.rpm mingetty-1.07-5.2.2.x86_64.rpm mkinitrd-5.1.19.6-61.x86_64.rpm mktemp-1.5-23.2.2.x86_64.rpm module-init-tools-3.3-0.pre3.1.60.el5.x86_64.rpm nash-5.1.19.6-61.x86_64.rpm ncurses-5.5-24.20060715.x86_64.rpm net-tools-1.60-81.el5.x86_64.rpm nspr-4.7.6-1.el5_4.x86_64.rpm nss-3.12.3.99.3-1.el5.centos.2.x86_64.rpm openssh-4.3p2-41.el5.x86_64.rpm openssh-server-4.3p2-41.el5.x86_64.rpm openssl-0.9.8e-12.el5_4.6.x86_64.rpm pam-0.99.6.2-6.el5_4.1.x86_64.rpm pcre-6.6-2.el5_1.7.x86_64.rpm popt-1.10.2.3-18.el5.x86_64.rpm procps-3.2.7-16.el5.x86_64.rpm psmisc-22.2-7.x86_64.rpm python-2.4.3-27.el5.x86_64.rpm python-elementtree-1.2.6-5.x86_64.rpm python-iniparse-0.2.3-4.el5.noarch.rpm python-sqlite-1.1.7-1.2.1.x86_64.rpm python-urlgrabber-3.1.0-5.el5.noarch.rpm readline-5.1-3.el5.x86_64.rpm rpm-4.4.2.3-18.el5.x86_64.rpm rpm-libs-4.4.2.3-18.el5.x86_64.rpm rpm-python-4.4.2.3-18.el5.x86_64.rpm sed-4.1.5-5.fc6.x86_64.rpm setup-2.5.58-7.el5.noarch.rpm sgpio-1.2.0_10-2.el5.x86_64.rpm shadow-utils-4.0.17-15.el5.x86_64.rpm sqlite-3.3.6-5.x86_64.rpm sysklogd-1.4.1-46.el5.x86_64.rpm SysVinit-2.86-15.el5.x86_64.rpm tar-1.15.1-30.el5.x86_64.rpm tcp_wrappers-7.6-40.7.el5.x86_64.rpm termcap-5.5-1.20060701.1.noarch.rpm testrun.sh tzdata-2010e-1.el5.noarch.rpm udev-095-14.21.el5.x86_64.rpm util-linux-2.13-0.52.el5_4.1.x86_64.rpm wget-1.11.4-2.el5_4.1.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 zlib-1.2.3-3.x86_64.rpm [root@vm2 centos-micro]#
Install necessary packages on the buildhost
[root@buildhost ~]# yum -y install anaconda anaconda-runtime mkisofs cdrecord