In this Zimbra Administrator’s PowerTip, we’ll discuss how to move your instance of Zimbra to another machine. It applies to all version of Zimbra.

Administrator’s PowerTip
#4: October 09, 2007
Zimbra Forums - Zimbra wiki - Zimbra
Blog
Introduction
Either you, or someone you know has been there. Almost out of Disk space, RAM is topped out, and the CPU is constantly running above 80%. It’s time to upgrade the hardware. But how easy and safe is it to move the Zimbra server instance? Well, it’s easier than you might think.
In this Zimbra Administrator’s PowerTip, we’ll discuss how to migrate your Zimbra server to another Machine or OS. The one big caveat is that both instances of Zimbra MUST be running the same version. So if your old server is running 4.5.5, then you’ll need to install 4.5.5 on your new server. This wouldn’t be the time to upgrade your ZCS version.
Part 1 : Backing Up
Step by Step:
- As zimbra: zmcontrol stop
- As root: ps aux | grep zimbra (make sure everything’s stopped)
- Mount external disc to location of your choice. ex: /mnt/migration
- As root: rsync -avr /opt/zimbra /mnt/migration (this may take a while)
Zimbra Network Edition contains a backup feature, and although it’s useful, we won’t be using it in this tip.
We have an external Hard Disc mounted to /mnt/migration. When rsync’ed, this is now your live copy (although it’s not live), and you should always have a backup of your live data. So, you might want to rsync again to another location to be safe.
Once you’ve rsync’ed all your data, umount the external drive, and put it somewhere safe.
Part 2 : Meet Your New Server
Step by Step:
- Install Newer (supported) Operating System
- Turn off older ZCS Server
- Set up newer ZCS Server’s Network/Hostname is it was on the older server
The only thing that really matters on your new server, is whether or not meets Zimbra’s server Hardware and the Operating System requirements.
It’s also very important that you have resolved any dependency issues. The ZCS installer for your newer OS should check for these.
Setup the newer server with the old server’s networking attributes. Make sure your older server is offline.
If changing the hostname, please see this wiki article: Set zmhostname
Part 3 : Create a "dummy" Install Then Remove It
Step by Step:
- Download the version of ZCS (ie 4.5.5 or 4.0) for the new OS you have
- As Root: Run the installer with the -s option: ./install.sh -s
- As Root: Remove the dummy install: rm -rf /opt/zimbra
The goal of this step is to get the rpm/dpkg databases correct. When you download ZCS, make sure it’s for your newer OS, and the SAME version of ZCS that’s rsync’ed.
Run the installer with the -s option. This tells the installer to only install the software, and not to configure the installation.
Once the installer has completed, delete it by rm -rf /opt/zimbra. This wipes any dummy data you have in that location.
Part 4 : Mount Your Backup HD, rsync, and Install
Step by Step:
- Mount external Hard drive
- As Root: rsync your backup to the new location: rsync -avr /mnt/migration/zimbra /opt/
- Unmount external Hard drive and keep it safe
- As Root: run zmfixperms located in /opt/zimbra/libexec
- As Root: rerun the installer without the -s option
Connect and mount your external hard drive. Then, rsync the backed up data to its new location (rsync -avr /mnt/migration/zimbra /opt).
Connect and mount your external hard drive. Then, rsync the backed up data to its new location (rsync -avr /mnt/migration/zimbra /opt).
Unmount your backed up copy, and keep it in a safe place.
Now that our data is all in place, we need to fix some permissions. Go into the /opt/zimbra/libexec directory and run zmfixperms. This helps insure that all the files are owned correctly.
Once that has completed, re run the installer that you downloaded. It will detect ZCS already installed, and ask if you want to upgrade. Select Yes.
18 Responses to 'Moving ZCS to Another Server'
Leave a Reply
| Blog Home
|
on October 10th, 2007 at 8:45 am
Thanks!
on October 10th, 2007 at 9:58 pm
Following this guide my Zimbra install would not start on the new server (Open Source Edition - RHEL5, moved from RHEL4).
One thing you might want to add to this guide is to make sure the zimbra user on the new server has the same UID/GID as the old server, or to change localconfig.xml to reflect the properties of the zimbra user on the new server.
on October 11th, 2007 at 4:10 pm
I followed this recipe although I had to alter it a little bit because I’m running Zimbra in an OpenVZ VPS.
My goal was to migrate from Zimbra for RHEL4 running on a CentOS 4 VPS to Zimbra for RHEL5 running on a CentOS 5 VPS.
For my new machine I created a new VPS while the original VPS ran. The new VPS had a different hostname and IP while I was working on it. After everything was configured and installed… I stopped both VPSes, switched VPS private dirs, rsyc’ed the /opt/zimbra directory. Since I switched private dirs, I was able to start up the new machine with the hostname and ip of the original. Then I progressed through the rest of the steps in the recipe.
Total down time was about 10 minutes and most of that was for the rysnc. I could have reduced the down time by doing an initial rsync of /opt/zimbra before taking down the original machine, and then doing a much faster second pass rsync after shutting down both machines. Another good thing is that I had my original machine’s VPS directory still around so if I had screwed up and the data migration had failed, I could have instantly switched back to the original.
Of course I don’t have zillions of accounts and the total amount of disk space of /opt/zimbra was only 4.3 GB… so that helped too.
on October 17th, 2007 at 7:07 am
The Intro says this will migrate to a new OS, but that’s simply not possible with this tip. I am trying to migrate from MacOSX to RHEL4.
Any hints for that?
on November 3rd, 2007 at 9:43 pm
Hi Jeffery,
You bring up an important point. Mac is kind of an exception I should have mentioned simply because of how it’s packaged.
The only alteration is that you should dump ldap to file, and re-import it using slapcat.
More information on that can be found in the PowerTip about ldap.
on November 7th, 2007 at 5:52 am
Thanks John. I’ve followed these instructions to update from 4.5.9 running on FC4 to 4.5.9 running on CentOS 5 but haven’t been able to get it working. When I do the final run on install.sh I get errors once ldap is started (account.NO_SUCH_SERVER and account.NO_SUCH_COS). Then when it goes to set up the ports, it doesn’t seem to know what ports are being used so wants me to enter that information. It’s as if some of the server configuration isn’t being brought in to LDAP. Any ideas? The source server is running fine. I can post this in the forum if it’s more appropriate.
on November 29th, 2007 at 10:16 am
@Justin,
Sorry it took so long for me to reply! I must have missed this one.
Looks like your localconfig.xml got wiped. This can occur on multiple failed restores. Did you try restoring that file from your backup?
on November 30th, 2007 at 4:47 am
No worries John. I also posted to the forums and have got it going. Check out this link for the fix.
http://www.zimbra.com/forums/installation/12681-solved-problems-migrating-new-server.html
on December 1st, 2007 at 4:28 pm
Hello I seem to be getting the following errors when i run the zmfixperms command
./zmfixperms
: command not found/get_plat_tag.sh: line 26:
: command not found/get_plat_tag.sh: line 27:
/opt/zimbra/libexec/get_plat_tag.sh: line 33: syntax error near unexpected token `else’
‘opt/zimbra/libexec/get_plat_tag.sh: line 33: ` else
on December 1st, 2007 at 4:31 pm
There seems to be something wrong with your command line interpreter.
Try running it like this:
/opt/zimbra/libexec/zmfixperms
on May 28th, 2008 at 2:14 am
Zimbra comments…
Zimbra issues Folders in webclient showing deleted messages in new message count…
on September 18th, 2008 at 2:33 pm
Will this method work to upgrade from a 32 bit OS to a 64 bit OS? I’ve created a new server to replace the old one and would like to install RHEL 64 bit - current server is running 32 bit.
on September 20th, 2008 at 7:13 am
I also have same requirement as Bill Weaver, I am moving from Centos 32 bit to 64bit Ubuntu8.04, I have the 64bit working fine in Ubuntu, looking for the steps to migrate.
on September 20th, 2008 at 7:17 am
Did see this URL
http://wiki.zimbra.com/index.php?title=Network_Edition:_Moving_from_32-bit_to_64-bit_Server
after I posted, will this work for the community edition also?
on September 30th, 2008 at 5:01 pm
@ Bill Weaver:
This method will not work to go from 32-bit to 64. The internal format of the LDAP data files are different between the two architectures, so even though the binaries get re-installed in the second installation step, your LDAP files would be broken. This document http://wiki.zimbra.com/index.php?title=Network_Edition:_Moving_from_32-bit_to_64-bit_Server outlines a method to move from 32 to 64-bit that makes sense, though I’ve not tried it myself. I plan to do that shortly though.
on October 15th, 2008 at 11:18 am
Good day,
I am moving from fedora7 to RHEL5.2 and I don’t have physical access to the servers(only remote)
Is there a way to do this move to a different IP?
Thnx
on October 18th, 2008 at 1:27 pm
Just used this, even tho’ it was a NE install. There were just a few issues I can into, some probably b/c of my own fault. That, plus some tips, below:
- for some reason when (after copying) running the install.sh, it was copying an /opt/zimbra/.saveconfig/config.save that did not have my settings in it (most values were blank). The result is that ldap would not be able to start (javax.naming.CommunicationException problem). So before accepting the license, I would re-copy my proper config.save in… that worked fine.
- permissions problem on /opt/zimbra/redolog/ (probably b/c I was messing with the uid/gid numbers, and zmfixperms didn’t catch it the first time)
- Tip… watch in the /tmp directory, there is an install.log.xxxxx (numbers) and a zimbra-install.???? (something) files that are written to, it helped me to figure out the ldap problem
- B/c of permissions problem, mailbox could not start… /opt/zimbra/log/mailboxd.log flat out told me it could not open the redo.log, so that was easy
I have one remaining issue with regard to the cert and the .ssh directory, will fix later today (error thrown when I go into admin UI, certificates…)
on November 13th, 2008 at 3:38 pm
Trying to do this using Tiger and 5.0.10 NE, I found these instructions didn’t quite work for me. Ultimately I found that I needed to do part 4 step 5 by running ./install-mac.sh -d and pointing it to the .dmg file, as root, from /opt/zimbra/libexec/installer.