Building a customised Red Hat install disc (Enterprise Linux 3) G.R.Keech 2004-09-13 Scope This document describes how to prepare a customised Red Hat Enterprise Linux (RHEL) CD. The resultant disc can be used to install a minimal RHEL version 3 system with: a. automated custom installation using kickstart; b. a single CD instead of four; c. custom packages on the disc. Summary Procedure Building a custom install disc involves: a. copy the normal install discs to a system in the same way you would when configuring a network install server; b. install required packages and setup shell environment; c. customise the comps.xml; d. (if required) customise package set; e. execute commands pkgorder, genhdlist, buildinstall, splittree, genhdlist (again); f. add kickstart config file and customise isolinux.cfg as required; g. run mkisofs, implantisomd5; h. burn ISOs as required. Detailed Procedure Build Tree. The install tree is prepared by copying the normal install discs into a single tree in the same manner as preparing a system to serve network installations Refer to: http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/x8664-multi-install-guide/s1-steps-network-installs.html In contrast with the server requirements for a network install, the build tree in this case also requires the isolinux files. For the purposes of this document, the directory in which the install tree is put is refered to as $RHROOT. Required packages. The anaconda and anaconda-runtime packages must be installed. In addtion mkisofs and cdrecord are also appropriate. Many of the scripts provided in these packages are Python scripts. For them to work properly the PYTHONPATH variable must be set to /usr/lib/anaconda and be exported in the shell environment in which the commands are run. Many of the scripts are from the directory /usr/lib/anaconda-runtime, so either put this in the PATH or provide an absolute path to commands. rpm -ivh $RHROOT/RedHat/RPMS/anaconda{,-runtime}*.i386.rpm rpm -ivh $RHROOT/RedHat/RPMS/mkisofs*.rpm rpm -ivh $RHROOT/RedHat/RPMS/cdrecord*.rpm export PYTHONPATH=/usr/lib/anaconda export PATH=$PATH:/usr/lib/anaconda-runtime Comps file. The file $RHROOT/RedHat/base/comps.xml defines the set of packages known to the installer. The set of packages described in comps.xml must be reduced to only those required. It is not necessary to remove the unused package files from $RHROOT/RedHat/RPMS/. Some packages from $RHROOT/RedHat/RPMS/ are necessary in the process of building the install CD even though they might be excluded from the custom build. An example comps.xml file is provided at Appendix 1. Customise package set. If required, custom packages can be added under $RHROOT/RedHat/RPMS/. These packages need to be referenced in the comps.xml file. Package signing is not strictly required ie the lack of a package signature will not prevent the installation of a package. Notwithstanding, package signing is a good idea. Refer: http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/sysadmin-guide/s1-check-rpm-sig.html and http://www.redhat.com/docs/books/max-rpm/max-rpm-html/s1-rpm-commands-resign-mode.html and http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/step-guide/s1-gnupg-keypair.html. Pkgorder. Run the command: pkgorder $RHROOT i386 > $RHROOT/pkgorder-i386.txt Genhdlist. Run the command: genhdlist --fileorder $RHROOT/pkgorder-i386.txt $RHROOT Buildinstall. Run the command: buildinstall --comp dist-3.0 --pkgorder $RHROOT/pkgorder-i386.txt \ --release "RHEL3ESU3 custom" --product "RHEL3ESU3 custom" --version 3.0 \ $RHROOT At this point the tree under $RHROOT can now be used for a network installation of the customised distribution. Splittree. Run the command: splittree.py --arch=i386 --total-discs=2 --bin-discs=1 --src-discs=1 \ --release-string='RHEL3ESU3 custom' --pkgorderfile=$RHROOT/pkgorder-i386.txt \ --distdir=$RHROOT --srcdir=$RHROOT/SRPMS The result of this command is a new directory tree for each disc with the names like ${RHROOT}-disc1. Second genhdlist. Run the command: genhdlist --withnumbers --fileorder $RHROOT/pkgorder-i386.txt ${RHROOT}-disc1 This is necessary even on a single-disk build. Add kickstart. The directdory tree under ${RHROOT}-disc1 will become the ISO filesystem so it is here that any final customisations should be made. This includes the addition of any optional kickstart files. An example kickstart file is included at Appendix 2. Isolinux.cfg. The kickstart installation can be referenced in the file ${RHROOT}-disc1/isolinux/isolinux.cfg as follows: label custom kernel vmlinuz append ks=cdrom:/ks.cfg initrd=initrd.img Mkisofs. The ISO file of disc1 can be created as follows: mkisofs -r -N -L -d -J -T -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \ -V "RHEL3ESU3 custom disc 1" -boot-load-size 4 -boot-info-table -o customel3.iso ${RHROOT}-disc1 This creates a bootable (ie El Torrito) ISO file system. If there are any other discs then their creation will use something like: mkisofs -r -N -L -d -J -T n \ -V "RHEL3ESU3 custom disc 2" -o customel3disc2.iso ${RHROOT}-disc2 Burn to CD. The ISO can be burned to CD as follows: cdrecord -tao fs=64M speed=8 dev=0,0,0 customel3.iso Obviously the speed and device options here will vary from system to system. ======================================================================================== Appendix 1 Example customised comps.xml file This comps file, when used with a custom build of RHEL3ESU3 produced a single disc with 695 packages totalling 492MB. The ISO file produced was 602MB. ----------------------------------------------------------------------------------- core Core true Smallest possible installation false ash basesystem bash coreutils cpio e2fsprogs ed file filesystem glibc grub hdparm hotplug initscripts iproute iprutils iputils kbd kernel libgcc libtermcap losetup passwd procps raidtools readline redhat-logos rootfiles rpm setserial setup sysklogd SysVinit termcap util-linux vim-minimal authconfig kudzu redhat-config-mouse shadow-utils redhat-release base Base false true core acl apmd acpid aspell at attr authconfig bc bind-utils bzip2 crontabs cyrus-sasl-plain cyrus-sasl-gssapi devlabel dhclient diffutils dos2unix dosfstools ethtool eject fbset finger ftp gpm iptables iscsi jpackage-utils kernel-utils krbafs-utils krb5-workstation kudzu laus lftp lha logrotate lsof lslk logwatch mailcap man man-pages mdadm mgetty mkbootdisk mt-st mtools mtr nano nc ncompress netconfig netdump nss_ldap ntsysv openssh-clients pam_krb5 pam_passwdqc pam_smb parted pax pciutils pinfo prctl prelink psacct quota redhat-config-network-tui redhat-config-securitylevel-tui redhat-logos redhat-lsb rsync jwhois schedutils setarch setuptool sendmail sharutils slocate specspo sudo stunnel symlinks sysreport tcp_wrappers telnet tftp traceroute time tmpwatch up2date utempter tcpdump openssh-server wget unix2dos unzip vim-common vixie-cron zip freetype rpm-python cups-libs rhnlib libtiff pyOpenSSL ntp printing true true Printing Support a2ps base-x true true X Window System printing authconfig-gtk bitmap-fonts firstboot desktop-backgrounds-basic desktop-backgrounds-extra gdm openssh-askpass redhat-config-date redhat-config-network redhat-config-services redhat-config-users redhat-config-xfree86 redhat-logviewer redhat-config-printer-gui redhat-config-packages switchdesk tkinter usermode-gtk xterm XFree86 XFree86-font-utils XFree86-tools XFree86-twm XFree86-xauth XFree86-75dpi-fonts XFree86-100dpi-fonts xinitrc XFree86-xdm up2date-gnome rhn-applet XFree86-Xvfb rhgb redhat-config-xfree86 atk gtk2 libglade2 pango pygtk2 pygtk2-libglade qt redhat-artwork xsri XFree86-Mesa-libGLU libjpeg libmng libstdc++ dialup false true Dialup Networking Support minicom statserial gnome-desktop true true GNOME Desktop Environment base-x at-spi control-center desktop-file-utils desktop-printing eog file-roller gconf-editor gedit gftp gimp-print-utils gnome-applets gnome-audio gnome-icon-theme gnome-media gnome-panel gnome-session gnome-system-monitor gnome-terminal gnome-themes gnome-utils gnome-vfs2-extras gtk-engines gtk2-engines ggv magicdev hwbrowser metacity nautilus nautilus-media switchdesk-gnome yelp workstation-common false Workstation Common base base-x server false Server base caching-nameserver graphical-internet Graphical Internet true true indexhtml ================================================================================ Appendix 2 Example Kickstart configuration file This file was named ks.cfg and placed in the root directory of the ISO filesystem. ------------------------------------ install text cdrom lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 keyboard us mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw changeme firewall --enabled authconfig --enableshadow --enablemd5 timezone --utc Australia/Sydney bootloader --location=mbr clearpart --all part /boot --fstype ext3 --size=100 part / --fstype ext3 --size=4096 part /spare --fstype ext3 --grow --size=2048 part swap --size=2048 --ondisk=hda %packages @server @base-x %post ( echo ALL:ALL > /etc/hosts.deny cat << EOF > /etc/hosts.allow ALL:localhost sshd:ALL EOF for service in cups mdmpd mdmonitor irqbalance rawdevices do chkconfig $service off done rpm --import /usr/share/rhn/RPM-GPG-KEY ) >> /tmp/ks.log