Thanks marcmac, your suggestion works perfectly.
In case anybody is interested, below is my (edited) ks.cfg file. A few notes:
-This ks.cfg file is designed to be used for both Installation and Disaster Recovery. Installation is totally automated (OS + Zimbra + Zimbra Configuration) and completes in about 20 minutes. (If you choose to install the GUI, add another 20 minutes or so.) The installed system automatically creates nightly backups to be used in Disaster Recovery. Disaster Recovery times will, of course, vary depending on number and size of mailboxes but will be totally automated (OS + Zimbra + Zimbra Restoration).
-Requirements:
CentOS/RHEL/Fedora Installation CD #1
CentOS/RHEL/Fedora Installation CD #2 (only if you want GUI)
External USB drive for ks.cfg file and Zimbra backups
-This ks.cfg file was tested with CentOS 4.2 and Zimbra M2. Since CentOS is a clone of RHEL, it should work for RHEL with no changes. It should also work for Fedora Core with few changes.
-This ks.cfg file assumes that you have a zimbra folder on the external USB drive. That zimbra folder should contain the following:
ks.cfg
zcs-3.0.0_M2_740.RHEL4.tgz
zcs_installation_answer_file.txt (the answer file as described by marcmac)
zcs_zmprov_configuration.txt (a list of commands to create initial accounts and distribution lists and configure Zimbra settings, as described in the admin manual)
-Nightly backups created after the system is in production will go into the zimbra folder on the USB drive and are on a 4-day rotation.
-Since this ks.cfg is on an external USB drive, type the following at the CentOS/RHEL/Fedora boot prompt:
linux ks=hd:sda1/zimbra/ks.cfg
replacing sda1 with the proper designation for your USB drive.
-Installation/Recovery goes as follows:
Minimal OS installation is performed (unless you enable the GUI).
USB drive designation (sda1, sdb2, etc.) is determined and placed into the backup/restore scripts.
(Optional) yum OS updates.
Sendmail is disabled.
/etc/hosts is fixed.
zimbra.backup.sh is written to /etc/cron.daily/.
An example .fetchmailrc is copied to /root/ in case you need a fetchmail script.
/etc/sysconfig/i18n is modified to prevent Zimbra installation from creating too many unicode_start processes when being run in a non-GUI session.
zcs_restore.sh is written to /root/.
/etc/rc.d/rc.local is modified to start the Zimbra installation at the next boot.
OS installation completes, CD ejects, user reboots.
OS loads.
Zimbra installs using answer file zcs_installation_answer_file.txt.
zmprov configures Zimbra using zcs_zmprov_configuration.txt.
If zimbra.backup.tar.gz is found on the USB drive, it is untarred (restoring all mailboxes and Zimbra configuration).
Zimbra services are started.
/etc/rc.d/rc.local is returned to its original configuration.
Every night, Zimbra is backed up to the USB drive as zimbra.backup.tar.gz.
I hope this is of assistance to somebody. Let me know if you have any questions.
Code:
install
cdrom
lang en_US.UTF-8
langsupport --default=en_US.UTF-8 en_US.UTF-8
keyboard us
xconfig --card "NVIDIA GeForce 2 GTS (generic)" --videoram 32768 --hsync 30-70 --vsync 50-160 --resolution 800x600 --depth 16
network --device eth0 --bootproto static --ip your.ip.address.here --netmask your.netmask.address.here --gateway your.gateway.address.here --nameserver your.first.nameserver.here,your.second.nameserver.here --hostname your.hostname.here
rootpw --iscrypted YourEncryptedPasswordHere
firewall --disabled
selinux --disabled
authconfig --enableshadow --enablemd5
timezone America/New_York
bootloader --location=mbr
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --drives=hda
part /boot --fstype ext3 --size=100 --ondisk=hda
part pv.6 --size=0 --grow --ondisk=hda
volgroup VolGroup00 --pesize=32768 pv.6
logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=512 --grow --maxsize=1024
%packages
#@ office
#@ admin-tools
#@ editors
#@ text-internet
#@ dialup
#@ graphics
#@ printing
#@ sound-and-video
# Enable the next three lines for GUI
#@ base-x
#@ gnome-desktop
#@ graphical-internet
kernel
grub
lvm2
e2fsprogs
curl
fetchmail
libidn
%post
# Uncomment the next line if you want to see what's happening
# behind the scenes
#chvt 3
echo
echo ---------------------------------------------------------------------
echo Beginning POST section of ks.cfg
echo ---------------------------------------------------------------------
export USB_drive=`cat /proc/cmdline | awk '{print $4}' | sed 's|ks=hd:||g' |sed 's|/zimbra/ks.cfg||g'`
echo
echo ---------------------------------------------------------------------
echo This ks.cfg file was loaded from:
echo $USB_drive
echo ---------------------------------------------------------------------
# For testing, comment out the next section to save time.
# For production, uncomment the section to ensure all updates are installed.
# If you uncomment this section, make sure you uncomment
# chvt 3 (above) and chvt 7 (below) so that you can see what's going on.
# If you are behind an HTTP proxy, uncomment and adjust the http_proxy line.
#echo
#echo ---------------------------------------------------------------------
#echo Downloading and installing updates
#echo ---------------------------------------------------------------------
#export http_proxy=http://your_proxy_username:your_proxy_password@your_proxy_hostname:your_proxy_port
#yum -y update
echo
echo ---------------------------------------------------------------------
echo Disabling Sendmail
echo ---------------------------------------------------------------------
chkconfig sendmail off
echo
echo -------------------------------------------------------------------
echo Modifying /etc/hosts
echo -------------------------------------------------------------------
mv /etc/hosts /etc/hosts.orig
cat << EOF > /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
your.ip.address.here your.FQDN.here
EOF
echo
echo -------------------------------------------------------------------
echo Creating /etc/cron.daily/zimbra_backup.sh
echo -------------------------------------------------------------------
cat << EOF >> /etc/cron.daily/zimbra_backup.sh
#!/bin/bash
# Mount the USB drive
mkdir -p /media/ZimbraBackup
mount /dev/$USB_drive /media/ZimbraBackup
# Stop the Zimbra services to get a good backup
service zimbra stop
# Rotate the backups
if [ -e /media/ZimbraBackup/zimbra/zimbra.backup.tar.gz.4 ];
then
rm -f /media/ZimbraBackup/zimbra.backup.tar.gz.4;
fi
if [ -e /media/ZimbraBackup/zimbra/zimbra.backup.tar.gz.3 ];
then
mv /media/ZimbraBackup/zimbra/zimbra.backup.tar.gz.3 /media/ZimbraBackup/zimbra/zimbra.backup.tar.gz.4;
fi
if [ -e /media/ZimbraBackup/zimbra/zimbra.backup.tar.gz.2 ];
then
mv /media/ZimbraBackup/zimbra/zimbra.backup.tar.gz.2 /media/ZimbraBackup/zimbra/zimbra.backup.tar.gz.3;
fi
if [ -e /media/ZimbraBackup/zimbra/zimbra.backup.tar.gz ];
then
mv /media/ZimbraBackup/zimbra/zimbra.backup.tar.gz /media/ZimbraBackup/zimbra/zimbra.backup.tar.gz.2;
fi
tar zcvf /media/ZimbraBackup/zimbra/zimbra.backup.tar.gz /opt/zimbra
# Start the Zimbra services so users can get their mail!
service zimbra start
# Unmount the USB drive
umount /media/ZimbraBackup/
rm -rf /media/ZimbraBackup/
EOF
chmod +x /etc/cron.daily/zimbra_backup.sh
echo
echo -------------------------------------------------------------------
echo Creating /root/.fetchmailrc
echo -------------------------------------------------------------------
cat << EOF >> /root/.fetchmailrc
poll your.old.mail.server proto pop3
user YourUsername there with password YourPassword is YourUsername@YourZimbraDomain.com here keep
# to flush the messages from the old server, remove the word "keep" from above
EOF
chmod 710 /root/.fetchmailrc
echo
echo -------------------------------------------------------------------
echo Modifying /etc/sysconfig/i18n
echo -------------------------------------------------------------------
mv /etc/sysconfig/i18n /etc/sysconfig/i18n.orig
cat << EOF > /etc/sysconfig/i18n
LANG="en_US"
SUPPORTED="en_US:en"
SYSFONT="latarcyrheb-sun16"
EOF
echo
echo -------------------------------------------------------------------
echo Creating /root/zcs_restore.sh
echo -------------------------------------------------------------------
cat << EOF >> /root/zcs_restore.sh
#!/bin/bash
echo
echo -----------------------------------------------------------------
echo Ready to restore Zimbra data from USB drive.
echo Press Enter to continue, or Ctrl-C to cancel.
echo -----------------------------------------------------------------
read input
service zimbra stop
rm -rf /opt/zimbra/
cd /
mkdir -p /media/ZimbraRestore
mount /dev/$USB_drive /media/ZimbraRestore
tar zxvf /media/ZimbraRestore/zimbra/zimbra.backup.tar.gz
umount /media/ZimbraRestore
rm -rf /media/ZimbraRestore
service zimbra start
EOF
chmod +x /root/zcs_restore.sh
echo
echo ---------------------------------------------------------------------
echo Configuring /etc/rc.d/rc.local to install Zimbra at next boot
echo ---------------------------------------------------------------------
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.orig
cat << EOF >> /etc/rc.local
echo
echo -----------------------------------------------------------------
echo Mounting USB drive.
echo -----------------------------------------------------------------
mkdir -p /media/ZimbraInstall/
mount /dev/$USB_drive /media/ZimbraInstall/
echo
echo -----------------------------------------------------------------
echo Installing Zimbra Collaboration Suite.
echo -----------------------------------------------------------------
cd /root/
tar zxvf /media/ZimbraInstall/zimbra/zcs*.tgz
cd /root/zcs/
./install.sh < /media/ZimbraInstall/zimbra/zcs_installation_answer_file.txt
echo
echo -----------------------------------------------------------------
echo Configuring Zimbra and adding user accounts.
echo -----------------------------------------------------------------
/opt/zimbra/bin/zmprov < /media/ZimbraInstall/zimbra/zcs_zmprov_configuration.txt
echo
if [ -x /media/ZimbraInstall/zimbra/zimbra.backup.tar.gz ]
then
echo
echo -----------------------------------------------------------------
echo Restoring Zimbra mailboxes.
echo -----------------------------------------------------------------
service zimbra stop
rm -rf /opt/zimbra/
cd /
tar zxvf /media/ZimbraInstall/zimbra/zimbra.backup.tar.gz
fi
echo
echo -----------------------------------------------------------------
echo Unmounting USB drive.
echo -----------------------------------------------------------------
umount /media/ZimbraInstall
rm -rf /media/ZimbraInstall
echo
echo -----------------------------------------------------------------
echo Starting Zimbra.
echo -----------------------------------------------------------------
service zimbra start
echo
echo -----------------------------------------------------------------
echo Fixing /etc/rc.d/rc.local.
echo -----------------------------------------------------------------
rm -f /etc/rc.d/rc.local
cp /etc/rc.d/rc.local.orig /etc/rc.d/rc.local
EOF
echo
echo ---------------------------------------------------------------------
echo Done!
echo ---------------------------------------------------------------------
# Uncomment the next section if you uncommented the
# chvt 3 line near the top of this file
#sleep 10s
#chvt 7 -