CentOS 5.5 x86 64 (Minimal) Hypervisor Edition

From WBITT's Cooker!

(Difference between revisions)
Jump to: navigation, search
(comps.xml)
(Scripts used to test RPMs, create repo, and build ISO)
Line 150: Line 150:
==Scripts used to test RPMs, create repo, and build ISO==
==Scripts used to test RPMs, create repo, and build ISO==
 +
===Test RPMs (testrun.sh)===
<pre>
<pre>
[root@buildhost-64 tmp]# cat testrun.sh  
[root@buildhost-64 tmp]# cat testrun.sh  
#!/bin/bash
#!/bin/bash
 +
# TESTDIR is the location, where you have stored your RPMs, waiting to be tested.
TESTDIR=$1
TESTDIR=$1
if [ "$TESTDIR" == "" ] ; then
if [ "$TESTDIR" == "" ] ; then
Line 158: Line 160:
   exit 1
   exit 1
fi
fi
 +
 +
# Specify the directory, which you want to be the temporary test install path for the RPMs.
 +
# Note: It (RPMTEST) should be different than the TESTDIR varible.
RPMTEST="/tmp/RPMtest"
RPMTEST="/tmp/RPMtest"
rpm --initdb --dbpath ${RPMTEST}  
rpm --initdb --dbpath ${RPMTEST}  
rpm --test --dbpath ${RPMTEST} --root ${RPMTEST} -ivh ${TESTDIR}/*.rpm
rpm --test --dbpath ${RPMTEST} --root ${RPMTEST} -ivh ${TESTDIR}/*.rpm
 +
[root@buildhost-64 tmp]#
 +
</pre>
-
[root@buildhost-64 tmp]# cat creaerepo.sh  
+
===Create Repository (createrepo.sh)===
 +
<pre>
 +
[root@buildhost-64 tmp]# cat createrepo.sh  
#!/bin/bash
#!/bin/bash
BUILDDIR=$1
BUILDDIR=$1
Line 170: Line 179:
fi
fi
 +
# Change this to the name you are using for your temporary/work-copy of comps.xml
COMPSFILE="/tmp/comps.xml-hypervisor"
COMPSFILE="/tmp/comps.xml-hypervisor"
export DISCINFO=$(head -1 ${BUILDDIR}/.discinfo)
export DISCINFO=$(head -1 ${BUILDDIR}/.discinfo)
 +
# Remove all the file in the repodata directory, including comps.xml.
echo "Doing: rm -f /${BUILDDIR}/repodata/*"
echo "Doing: rm -f /${BUILDDIR}/repodata/*"
rm -f ${BUILDDIR}/repodata/*  
rm -f ${BUILDDIR}/repodata/*  
 +
# Copy your working copy of comps.xml to the repodata directory, inside the build directory.
echo "Doing: cp -v ${COMPSFILE} ${BUILDDIR}/repodata/comps.xml"
echo "Doing: cp -v ${COMPSFILE} ${BUILDDIR}/repodata/comps.xml"
cp -v ${COMPSFILE} ${BUILDDIR}/repodata/comps.xml  
cp -v ${COMPSFILE} ${BUILDDIR}/repodata/comps.xml  
 +
# Create the repository.
echo "Doing: createrepo -u "media://${DISCINFO}" -g ${BUILDDIR}/repodata/comps.xml ${BUILDDIR}/"
echo "Doing: createrepo -u "media://${DISCINFO}" -g ${BUILDDIR}/repodata/comps.xml ${BUILDDIR}/"
createrepo  -u "media://${DISCINFO}" -g ${BUILDDIR}/repodata/comps.xml ${BUILDDIR}/
createrepo  -u "media://${DISCINFO}" -g ${BUILDDIR}/repodata/comps.xml ${BUILDDIR}/
 +
[root@buildhost-64 tmp]#
 +
</pre>
 +
===Build ISO (buildiso.sh)===
 +
<pre>
[root@buildhost-64 tmp]# cat buildiso.sh  
[root@buildhost-64 tmp]# cat buildiso.sh  
#!/bin/bash
#!/bin/bash
Line 190: Line 207:
   exit 1
   exit 1
fi
fi
 +
 +
# This is where the resultant ISO image will be stored. Can be an NFS share.
ISODIR="/mnt/cdimages/"
ISODIR="/mnt/cdimages/"
 +
 +
# The name of the resultant ISO file.
ISOFILE="CentOS-5.5-x86_64-HypervisorEdition.iso"
ISOFILE="CentOS-5.5-x86_64-HypervisorEdition.iso"
-
# Remove the non-english RELEASE-NOTES.  
+
# Remove the non-english RELEASE-NOTES. Sorry guys!
rm -f ${BUILDDIR}/RELEASE-NOTES-[a-d,f-z]*
rm -f ${BUILDDIR}/RELEASE-NOTES-[a-d,f-z]*
-
# Remove NOTES directory, which contains RELEASE-NOTES in plathora of different languages.
+
# Remove NOTES directory, which contains RELEASE-NOTES in plethora of different languages. Sorry again!
rm -f ${BUILDDIR}/NOTES*
rm -f ${BUILDDIR}/NOTES*
-
# Remove the target ISO file, if it already exists.
+
# Remove the target ISO file, if it already exists. Just in case.
rm ${ISODIR}/${ISOFILE}
rm ${ISODIR}/${ISOFILE}

Revision as of 15:39, 3 January 2011

Contents

comps.xml

Here you see comps.xml-hypervisor , a filename of my own choice for a reason. When I am done editing the file, the createrepo.sh sript (shown below), copies it as "comps.xml" in the build tree.

[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-drv-vga</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-drv-cirrus</packagereq>
      <packagereq type="conditional" requires="xterm">xorg-x11-drv-fbdev</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>
    </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>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]#

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

Test RPMs (testrun.sh)

[root@buildhost-64 tmp]# cat testrun.sh 
#!/bin/bash
# TESTDIR is the location, where you have stored your RPMs, waiting to be tested.
TESTDIR=$1
if [ "$TESTDIR" == "" ] ; then
  echo "You should provide the name of test directory containing RPMS. Please specify full path."
  exit 1
fi

# Specify the directory, which you want to be the temporary test install path for the RPMs.
# Note: It (RPMTEST) should be different than the TESTDIR varible.
RPMTEST="/tmp/RPMtest"
rpm --initdb --dbpath ${RPMTEST} 
rpm --test --dbpath ${RPMTEST} --root ${RPMTEST} -ivh ${TESTDIR}/*.rpm
[root@buildhost-64 tmp]#

Create Repository (createrepo.sh)

[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

# Change this to the name you are using for your temporary/work-copy of comps.xml
COMPSFILE="/tmp/comps.xml-hypervisor"

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

# Remove all the file in the repodata directory, including comps.xml.
echo "Doing: rm -f /${BUILDDIR}/repodata/*"
rm -f ${BUILDDIR}/repodata/* 

# Copy your working copy of comps.xml to the repodata directory, inside the build directory.
echo "Doing: cp -v ${COMPSFILE} ${BUILDDIR}/repodata/comps.xml"
cp -v ${COMPSFILE} ${BUILDDIR}/repodata/comps.xml 

# Create the repository.
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]#

Build ISO (buildiso.sh)

[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

# This is where the resultant ISO image will be stored. Can be an NFS share.
ISODIR="/mnt/cdimages/"

# The name of the resultant ISO file.
ISOFILE="CentOS-5.5-x86_64-HypervisorEdition.iso"

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

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

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

# Create the README file in the CD root:
cat > ${BUILDDIR}/README << EOFREADME
################################################################################################
# README  : Contains summary about this CD
# Author  : Muhammad Kamran Azeem (kamran@wbitt.com)
# Created : 20110103
# Revision: 20110103
# Summary : This CD is CENTOS 5.5 x86_64 (64 bit), rebuilt by WBITT team, as Hypervisor Edition.
#################################################################################################
Detail:-
1) This is a bootable CD. (Of-course ;)
2) The CD contains four groups only: 
* core [Not visible in installer.]
* base
* xen (Named/shown as group: Virtualization)
* kvm (Named/shown as group: KVM)

3) These groups can be used in your kickstart files.
4) The groups are designed in such a way, that if you do not select any group (uncheck all of them at the time of installation), 
you will get a minimal installation, containing yum and wget. In minimal install you won't get any protection. 
5) SELINUX and IPTABLES are not installed in the minimal (@core) installation.
all other packages if needed must be copied, or installed from the CD directly.
Or whatever way you prefer, including, but not limiting to using YUM.
6) The base contains xterm. If you select that, xterm and its (minimal) necessary X packages will also get installed automatically. (Vesa drivers)
7) If you decide to use kickstart, then please note, that the software in this CD is (should be) compatible with your current kickstarts.
8) The complete CD can be copied to an NFS/HTTP/FTP server, and can in-turn be used for network based installations, of the same.
9) The CD has both KVM and XEN hypervisors. Includes kernel-xen. 
10) If you select the category "Virtualization" at the install time, and do not check "customize software selection", XEN will be installed.

End of README file.
EOFREADME

# Create a sample kickstart file in the CD root:
cat > ${BUILDDIR}/sample-kickstart.ks << EOFKS
################################################################################################
# Author : Muhammad Kamran Azeem (kamran@wbitt.com)
# Created: 2011-01-03
# Revised: 2011-01-03
# Summary: A minimalistic kickstart file by WBITT Team
# Note   : USE AT YOUR OWN RISK. Adjust as per your requirements.
################################################################################################
install
text
# url --url http://192.168.122.1/CentOS-5.5-x86_64-Hypervisor/
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp --hostname centos-55-64-hypervisor --noipv6
# The password below is actually redhat
rootpw --iscrypted $1$Q6duWtpC$OcyfP8NCdH1EZBxHmM/tL0
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --enabled
timezone Asia/Riyadh
# I prefer you create at least a 2 GB disk for the minimal install.
# Adjust the following three lines as needed.
# zerombr
# bootloader --location=mbr  --append=""
# clearpart --all --initlabel
# part / --fstype=ext3 --size=200 --grow
# part swap --fstype=swap --size=256
reboot

%packages
# The options for groups are: core, base, xen, kvm
@core

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


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

Personal tools