Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Installation

Reply
 
LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 12-02-2005, 01:19 PM
mubley mubley is offline
Senior Member
 
Join Date: Dec 2005
Posts: 44
mubley is on a distinguished road
Default Kickstart for automated installation and disaster recovery

I'd first like to say thanks to the entire Zimbra team for all their hard work on such a wonderful product. Now on to my question...

I've created a Kickstart file (ks.cfg) to perform an automated installation of the OS, Zimbra RPMs and my Zimbra backup. Once the OS is installed, my Kickstart file does the following:
Code:
cd /root/
tar zxvf /media/ZimbraInstall/zimbra/zcs*.tgz
rpm -Uvh /root/zcs/packages/zimbra*.rpm
rm -rf /opt/zimbra/
cd /
tar zxvf /media/ZimbraInstall/zimbra/zimbra.backup.tar.gz
In the current release, is it OK to install from the RPMs (not from install.sh) and then copy my backup of /opt/zimbra? I know that in the previous release, install.sh was required since it configured the IPTables rules. The current release doesn't require the IPTables rules, but is there anything else that install.sh does that I would be missing?

Thanks in advance for any information.
Reply With Quote
  #2 (permalink)  
Old 12-02-2005, 01:42 PM
marcmac marcmac is offline
Zimbra Employee
 
Join Date: Sep 2005
Posts: 2,068
marcmac is on a distinguished road
Default Not using install.sh

Off the top of my head (I've never tried this) you'll also need:

/etc/{password,shadow,group}
/etc/sudoers
/etc/init.d/whatever
/var/spool/cron/zimbra (assuming linux)

Make sure that the user has the same ID if you re-create it. If not, running zmfixperms.sh (as root) after the overlay of the backup might be a good idea.

Any particular reason you wouldn't want to do a backup/restore, rather than go through this process?
Reply With Quote
  #3 (permalink)  
Old 12-02-2005, 02:33 PM
mubley mubley is offline
Senior Member
 
Join Date: Dec 2005
Posts: 44
mubley is on a distinguished road
Default

Hi marcmac,

Thanks for the information and the quick reply.

Quote:
Off the top of my head (I've never tried this) you'll also need:

/etc/{password,shadow,group}
/etc/sudoers
/etc/init.d/whatever
/var/spool/cron/zimbra (assuming linux)
The RPMs automatically update the first three of these. I have nothing in /var/spool/cron/zimbra; I assume I should have a cron job for updating ClamAV? I'll add that manually with my Kickstart script.

Quote:
Make sure that the user has the same ID if you re-create it. If not, running zmfixperms.sh (as root) after the overlay of the backup might be a good idea.
The RPMs are creating the user account and since the Kickstart file executes the RPMs right after OS installation, zimbra is always user 500.
Quote:
Any particular reason you wouldn't want to do a backup/restore, rather than go through this process?
Perhaps I should've explained a little more in my original post. I've created a backup script that runs nightly and produces zimbra.backup.tar.gz on an external USB drive. If the server suffers a catastrophic failure, then all I have to do is repair/replace the hardware and run my Kickstart installation. Kickstart installs the OS, Zimbra, and restores all Zimbra data from zimbra.backup.tar.gz. Currently (with just a few test mailboxes), I can do this in under 30 minutes.
Reply With Quote
  #4 (permalink)  
Old 12-02-2005, 03:17 PM
marcmac marcmac is offline
Zimbra Employee
 
Join Date: Sep 2005
Posts: 2,068
marcmac is on a distinguished road
Default crontab

crontab -u zimbra -l shows nothing? THere's a pretty extensive zimbra crontab (not for clamav -that's done by the freshclam daemon)
Reply With Quote
  #5 (permalink)  
Old 12-03-2005, 06:06 AM
mubley mubley is offline
Senior Member
 
Join Date: Dec 2005
Posts: 44
mubley is on a distinguished road
Default

Quote:
crontab -u zimbra -l shows nothing? THere's a pretty extensive zimbra crontab (not for clamav -that's done by the freshclam daemon)
Yes, that command shows nothing when you install directly from the RPMs instead of using install.sh. This is configured by the setupCrontab() function in util/utilfunc.sh which is called by install.sh and never called when installing directly from RPMs. I can copy the setupCrontab() function into my Kickstart ks.cfg file and that will take care of it.

But...am I going about this the wrong way? Is there a better way to automate the Zimbra installation? Can I supply an answer file to install.sh? Or should I just write an expect script to supply the answers to install.sh?

Thanks again for your time and information.
Reply With Quote
  #6 (permalink)  
Old 12-03-2005, 09:34 AM
marcmac marcmac is offline
Zimbra Employee
 
Join Date: Sep 2005
Posts: 2,068
marcmac is on a distinguished road
Default automated install

You can use an answer file...

THere are 2 ways to do this.

THe easy way is to go through an installation, and record your keystrokes in the config step...

So, for a standard install, all defaults, with an admin password of "test123" I do this:

./install.sh
return
return
etc... then in the config
return
5
6
test123

a
n
y

So if you create a text file with [return], 5[return], etc in it, you can redirect that file into install.sh:
./install.sh < textfile
Reply With Quote
  #7 (permalink)  
Old 12-09-2005, 12:11 PM
mubley mubley is offline
Senior Member
 
Join Date: Dec 2005
Posts: 44
mubley is on a distinguished road
Default Kickstart ks.cfg

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
-
Reply With Quote
  #8 (permalink)  
Old 01-06-2006, 10:01 AM
jgao jgao is offline
Senior Member
 
Join Date: Dec 2005
Posts: 74
jgao is on a distinguished road
Default Automating Installation

Tried the input method for automating the installation. But failed on

The system will be modified. Continue? [N]
Exit? [N]

The same thing repeats for ever.

Seems the install.sh does not take input Y, but only [return]. I got an endless loop here. I don't understand where the so many [return] come from.

Any idea?

Thanks.
Reply With Quote
  #9 (permalink)  
Old 01-06-2006, 10:07 AM
marcmac marcmac is offline
Zimbra Employee
 
Join Date: Sep 2005
Posts: 2,068
marcmac is on a distinguished road
Default many happy returns

HOw are you generating the input file? Is it on a windows box? Make sure you generate it on the linux box, as a straight ascii text file...
Reply With Quote
  #10 (permalink)  
Old 01-06-2006, 10:12 AM
jgao jgao is offline
Senior Member
 
Join Date: Dec 2005
Posts: 74
jgao is on a distinguished road
Default

My input file is a one line text file, on FC4,

[return] Y Y Y Y Y Y Y 4 test123 5 6 test123 r a Yes [return] Yes [return]

The seventh Y is for the prompt I mentioned:
The system will be modified. Continue? [N]
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.zimbra.com/forums/installation/1006-kickstart-automated-installation-disaster-recovery.html
Posted By For Type Date
Private Jets WebLog » Blog Archive » USB News Archives November 2005 This thread Pingback 07-28-2007 04:22 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
Disaster Recovery on a Multi Server Configuration dlochart Administrators 2 04-14-2007 05:08 AM
Disaster Recovery Steps for v3.1.4 Network Edition ThorGoLucky Administrators 0 09-08-2006 11:08 AM


freshmeat.net sourceforge.net The best Java IDE



 

Search Engine Optimization by vBSEO 3.0.0