Crayz9000-Notes

Migrating from OSX Server (10.4, 32-bit) to Debian/Ubuntu 64-bit

The last supported version of Zimbra Collaboration Suite for Mac OSX is version 6, which is only supported on OSX 10.4 Tiger. Since no 64-bit version of Zimbra will be released for the OSX platform, the only way to migrate an OSX Zimbra installation is to move it to another platform entirely.

However, the documentation for this migration is misleading at best. It took about eight hours of migration attempts and failed installations before I came to the final working steps. Even then, after getting everything running, there were still some other issues that had to be resolved (see #Migration_Troubleshooting for more information). The steps listed below now include the extra information to avoid this hassle, so it should be possible to follow these steps and have a working Zimbra installation afterward.

Please note that my target server is running Debian Squeeze (6.0) which is at this time unsupported by Zimbra in version 7.x. There were several reasons for this:

  • I at first attempted to use Ubuntu 10.04 LTS Server. However, the kernel included with Ubuntu 10.04 does not include as much hardware support as the Debian Squeeze kernel, and could not boot on the HP ProLiant server I was using.
  • Debian Lenny (5.0) support ended in February 2012, meaning that there may be potential security issues with running that as a server OS.
  • There have been rumors on the Zimbra forums that Squeeze will be a supported platform in a future release of ZCS (perhaps 8.0, although nobody will confirm). This will make future upgrades of Zimbra easier, assuming that the rumors are correct.

If you are planning on migrating from Zimbra on OS X 10.4 to any other Linux platform, the steps should be almost identical. Just make sure to install the same version of Zimbra as your OSX server on the target server prior to beginning the migration.

Versions Used In This Tutorial

MacOS X ZCS version: 6.0.15_GA_2995.MACOSXx86

Debian ZCS initial version: 6.0.15_GA_2995.DEBIAN5_64

Debian ZCS final version: 7.1.4_GA_2555.DEBIAN5_64 DEBIAN6_64 FOSS edition

Reference Information

Most of these tutorials had bits of information that proved useful. Most of them also had commands that completely broke everything. If you want to read through them, they may give a better understanding of the entire process, but even they contradict each other at times.

Platform and OS Independent ZCS to ZCS Migration Using Rsync

Network_Edition:_Moving_from_32-bit_to_64-bit_Server

Ajcody-Notes-Server-Move

Email and Calendars with Zimbra on Debian 6 Squeeze


Directions

Thanks to how rsync works, most of the data can be copied to the new server up to several days in advance, meaning that the final rsync before the move should only take a few minutes to complete. This migration is best done during off times, as it may still take several hours to complete (depending on the size of your Zimbra installation).

Summary

  • Configure the new server with a temporary address and hostname
  • Shut down the Zimbra services on the old server
  • Rsync from OSX /opt/zimbra to /opt/zimbra.old on Debian
  • Install the same version of Zimbra for the new platform
  • Move /opt/zimbra to /opt/zimbra.new
  • Move /opt/zimbra.old to /opt/zimbra
  • rm -rf /opt/zimbra/logger/db/data/rrds
  • rm -rf /opt/zimbra/openldap-*
  • cp -R /opt/zimbra.new/openldap-* /opt/zimbra/
  • Back up LDAP data as described in Network_Edition:_Moving_from_32-bit_to_64-bit_Server
  • Rename both servers
  • Restore LDAP data
  • Do an upgrade install of 6.0.15_GA DEBIAN5 on top of the modified backup of /opt/zimbra
  • Pause at "Saving existing configuration file to /opt/zimbra/.saveconfig
  • Copy the ORIGINAL /opt/zimbra/config.***** to to /opt/zimbra/.saveconfig/config.save.
  • Finish installation and test.


1. Set up the new server

Most of the configuration is up to you. For this tutorial, I'm going to assume that your OSX server is named mail.example.com and the new Debian/Ubuntu server is tempmail.example.com, and that you have a separate authoritative name server (e.g. BIND server on firewall or MS Active Directory domain controller) for split DNS so you don't have to run DNS on the mail server. See the Split_DNS page for more information.

I am also going to assume that you are running as the local admin user, with sudo privileges.

2. Rsync from old to new

  • OSX: Before beginning the final rsync, make sure to shut down the Zimbra services.
sudo su - zimbra
zmcontrol stop
exit
  • Debian: Install rsync
sudo apt-get install rsync
  • OSX: rsync files to new server
sudo nice -n +19 rsync --progress -avzH -e ssh  /opt/zimbra/ root@tempmail.example.com:/opt/zimbra.old


3. Install dummy Zimbra on the new server

  • OSX: determine version. This document was written based on 6.0.15_GA. Latest is 6.0.16_GA.
sudo su - zimbra
zmcontrol -v
exit
  • Debian: Download and install same release on the new server

Open Source Edition Downloads

wget <paste link to correct platform/version here>
tar -xzvf zcs*
cd zcs*

If you are running Ubuntu or another supported platform, run this command. We are using the -s option to prevent the installer from trying to run the configuration at this time.

./install.sh -s

If you want to install on Debian 6, refer to the instructions here, remembering to add the -s option to install.sh:

Email and Calendars with Zimbra on Debian 6 Squeeze


4. Move /opt/zimbra and /opt/zimbra.old

We want to keep the Zimbra dummy installation in /opt/zimbra so we can copy as needed from it.

  • Debian:
sudo mv /opt/zimbra /opt/zimbra.new
sudo mv /opt/zimbra.old /opt/zimbra

5. Remove old RRDs

This step was added because the OSX RRDs get left behind when doing an upgrade, resulting in data that causes the Zimbra logger daemon to abort. See #Migration_Troubleshooting for more information.

  • Debian:
sudo rm -rfv /opt/zimbra/logger/db/data/rrds
sudo mkdir /opt/zimbra/logger/db/data/rrds

6. Replace binaries

Without doing this step, the LDAP data cannot be migrated since it relies on using the openldap bundled with Zimbra, and we just copied an installation over that has OSX binaries. To fix:

  • Debian:
sudo rm -rf /opt/zimbra/openldap-*
sudo rm -rf /opt/zimbra/bin
sudo rm -rf /opt/zimbra/libexec
sudo cp -R /opt/zimbra.new/openldap-* /opt/zimbra/
sudo cp -R /opt/zimbra.new/libexec /opt/zimbra/
sudo cp -R /opt/zimbra.new/bin /opt/zimbra


7. Back up LDAP database

Most of these directions were modified from the tutorial at Network_Edition:_Moving_from_32-bit_to_64-bit_Server

  • Debian: Repair permissions
sudo /opt/zimbra/libexec/zmfixperms --verbose --extended 
  • OSX: Export the LDAP data to the new server
    • Backup the LDAP data
sudo su - zimbra
/opt/zimbra/libexec/zmslapcat /tmp
    • Backup LDAP config data:
/opt/zimbra/libexec/zmslapcat -c /tmp
    • Copy ldap.bak:
sudo scp /tmp/ldap.bak root@tempmail.example.com:/tmp 
    • Copy ldap-config.bak:
sudo scp /tmp/ldap-config.bak root@tempmail.example.com:/tmp

8. Rename servers

  • Change the OSX server to a new name first; this can be particularly annoying, since there are multiple ways to do it in OSX; we might as well just do all of them...
sudo changeip <old IP> <new IP> oldname.example.com newname.example.com
sudo scutil --set HostName newname.example.com

Then verify in System Preferences, Server Admin, etc that the hostname has indeed changed properly.

  • Change the Debian or Ubuntu server to the correct name and IP. This is a little easier and only requires a couple of changes. IP configuration can be set using the Network Connections window in Ubuntu (also available in Debian), and the hostname can be set by editing /etc/hostname and then running
sudo /etc/init.d/hostname.sh

to set it.

  • Update your DNS server with the new information. If you have firewall rules on your NAT device to forward ports to the mail server, make sure they have been updated to reflect the changes.
  • Verify that the output of the following commands all match on the new server:
host `hostname`
host (logical hostname)
nslookup `hostname`
nslookup (logical hostname)
nslookup (old hostname)

9. Restore LDAP data

  • Debian: Clean the LDAP folders first.
sudo su - zimbra
rm -rf /opt/zimbra/data/ldap/hdb/*
  • Debian: Restore LDAP configuration
/opt/zimbra/openldap/sbin/slapadd -q -n 0 -F /opt/zimbra/data/ldap/config -cv -l /tmp/ldap-config.bak 
  • Debian: Restore LDAP database
/opt/zimbra/openldap/sbin/slapadd -q -b "" -F /opt/zimbra/data/ldap/config -cv -l /tmp/ldap.bak
exit

There should be no errors during this stage assuming the proper LDAP binaries were called.

10. Upgrade install over migration folder

  • Before running install.sh again, make sure to back up the configuration data since it appears that the installer accidentally overwrites this with bogus data.
sudo cp /opt/zimbra/conf/localconfig.xml /opt/zimbra/conf/localconfig.xml.orig
sudo cp -R /opt/zimbra/.saveconfig /opt/zimbra/.saveconfig.orig
  • Debian: cd to the zcs install folder as in step 3, then:
sudo ./install.sh

When the installer reaches the point "Saving existing configuration file to /opt/zimbra/.saveconfig", in a new terminal do the following:

sudo mv /opt/zimbra/.saveconfig/config.save /opt/zimbra/.saveconfig/config.save.bad
sudo cp /opt/zimbra/.saveconfig.orig/config.save /opt/zimbra/.saveconfig/

Continue with the installation and check to make sure that the config loaded properly. You may want to select the option to not start Zimbra automatically after completion of the install.

11. Post-Install Steps

  • Make sure that the permissions are still correct.
sudo /opt/zimbra/libexec/zmfixperms --verbose --extended
  • Re-generate SSH keys if Zimbra won't start properly, and make sure it's logging properly:
sudo su - zimbra
zmsshkeygen
zmupdateauthkeys
zmcontrol restart
exit
  • Edit the zmsyslogsetup script to correct for minor Debian6-related errors.
sudo nano /opt/zimbra/libexec/zmsyslogsetup

Replace line 480 with the following:

sudo /opt/zimbra/libexec/zmsyslogsetup

12. Upgrade to Version 7

See the Zimbra 7 Release Notes for more information. The process should work by simply following the "Single-Server Upgrade Steps", but there are some points that should be noted:

  • For Debian 6 users:

Downgrade dpkg to the version listed in Email and Calendars with Zimbra on Debian 6 Squeeze prior to running install.sh. Step 10 of my tutorial should not be needed, since the version 7 installer does not overwrite the configuration like the version 6 installer does.

  • After installation

Run

sudo apt-get install dpkg

to return dpkg to the correct version. Note that dpkg will complain about invalid characters in the Zimbra package; these messages can be safely ignored.

  • MySQL database update

Refer to the section "After the Upgrade is Complete" to run the MySQL upgrade script included with ZCS 7. If this is not done, you may receive email reports of database errors ("table upgrade required") and duplicate administrative report emails with empty content.

Migration Troubleshooting

Message in admin console: "Server status data is not available. To see the server status, logger service must be installed."

In this case, the issue was related to the RRDs that were inadvertently migrated from the old server. However, this conclusion did not come immediately since after running the diagnostic commands in Logger_(ZCS_6.0.x_and_later), the following error appeared:

zimbra@mail:~$ /opt/zimbra/libexec/zmrrdfetch -f zmmtastats

Host: <hostname>

Can't use an undefined value as an ARRAY reference at /opt/zimbra/libexec/zmrrdfetch line 135.

This error is baffling at best, since it seems to imply that there's a Perl issue with the zmrrdfetch script, like a bad variable. It's actually nothing of the sort, and further examinination of /opt/zimbra/log/zmlogswatch.out showed the actual cause:

x.x:x.x:x.x:x.x:x.x:x.x: This RRD was created on other architecture at /opt/zimbra/libexec/zmlogger line 394, () line xx

Searching for this error produced this page (in French): Server_status_data_is_not_available

In short, the RRDs on my server were generated by OSX on the original Zimbra install. During my migration, I did not remove them, and the Linux rrdtools choked on it when called by Perl. D'oh.

However, the "rm -f /opt/zimbra/logger/db/data/rrds/*.rrd" command they listed on the French page did not actually delete anything. Instead, I had to run the following commands, in order:

sudo rm -rfv /opt/zimbra/logger/db/data/rrds
sudo mkdir /opt/zimbra/logger/db/data/rrds
sudo /opt/zimbra/libexec/zmfixperms -v
sudo su - zimbra
zmcontrol restart

Immediately after reloading, the admin console status page began displaying information (although do not be alarmed if, at first, it shows all services stopped). Within 5 to 10 minutes, the correct status information should appear.

Debian Squeeze-Specific Issues

/opt/zimbra/libexec/zmsyslogsetup returns "cat: /var/run/syslog*.pid: No such file or directory"

This is due to lack of official support for Debian Squeeze in ZCS7, and the fact that we've installed the Debian Lenny (5.0) package. In this case, we need to edit the script to recognize that the DEBIAN6 platform uses rsyslogd like DEBIAN5. However, the script still finds the rsyslogd.conf file and updates it without this patch, so this is more of an annoyance than anything.

Edit /opt/zimbra/libexec/zmsyslogsetup and replace line 480 with the following:

} elsif ( $platform =~ /DEBIAN5/ || $platform =~ /DEBIAN6/ || $platform =~ /F10/ || $platform =~ /F11/ ) {


Other Issues

Two daily mail report messages: one normal, one empty?

If you are receiving two messages, one with the normal daily tallies, and a second one which is empty, both under the same subject, this may be due to the MySQL database upgrade not being performed after a version 6 to 7 upgrade. Refer to the "After the Upgrade is Complete" section of the ZCS 7 release notes for directions to run the upgrade script.

Normal message:

Grand Totals
------------
messages

   1316   received
   1267   delivered
      0   forwarded
    576   deferred  (10110  deferrals)
     94   bounced
   1300   rejected (50%)
      0   reject warnings
      0   held
      0   discarded (0%)

Empty duplicate:

Grand Totals
------------
messages

      0   received
      0   delivered
      0   forwarded
      0   deferred
      0   bounced
      0   rejected (0%)
      0   reject warnings
      0   held
      0   discarded (0%)

Some digging on the forum yields this information:

http://www.zimbra.com/forums/administrators/13346-solved-empty-admin-report.html

Sure enough, I had the following message:

Database Integrity Check Report

Database errors found.
/opt/zimbra/mysql/bin/mysqlcheck --defaults-file=/opt/zimbra/conf/my.cnf -S /opt/zimbra/db/mysql.sock -A -C -s -u root --password=********
mboxgroup1.appointment
error    : Table upgrade required. Please do "REPAIR TABLE `appointment`" or dump/reload to fix it!
...
(about 50 more lines snipped)
Jump to: navigation, search