How to move ZCS to another server
How to move ZCS to another server
In this article, we will explain how to move/migrate a zimbra server to another machine.
Both the source and destination zimbra servers must be running the same version. E.g. if source is running 8.6, the installed zimbra on the destination must be also 8.6.
In a nutshell, the solution is: stop zimbra on the source server, make a backup of /opt/zimbra, install new server, stop the old server, set up the new server's networking and hosts config, install software zcs to the new machine, substitute the /opt/zimbra on the new machine with the already made backup from the old machine, fix permissions, run a normal zcs install.
Below are the exact steps that needs to be taken, to complete the migration:
On the old server:
1. # su - zimbra
2. $ zmcontrol stop
3. $ exit
4. Make sure all zimbra services are stopped:
ps aux | grep zimbra
5. Now, you can copy the /opt/zimbra directory to another backup location, and from there to copy it to the destination server later, or you could mount external disc and copy it there, or simply copy it to the destination server (if already installed with the correct OS).
As root user, copy it to the remote machine (rsync can take a while, so before you put any deadline on a project, make sure you first rsync all data beforehand):
rsync -e ssh -axvzKHS /opt/zimbra/ 10.0.0.1:/tmp
that command will copy /opt/zimbra directory to a remote machine with IP 10.0.0.1, in the /tmp directory (using ssh). Or, you can copy it to a local mounted disk:
rsync -axvzKHS /opt/zimbra /mnt/zimbra_backup
6. Install a new server, with supported Operating System for the zcs version. The bit level (32-bit vs. 64-bit) or the Operating System build (RHEL 5, RHEL 6, Ubuntu 12, etc.) may be different than the source server.
7. Turn off the old ZCS Server
shutdown -h now
On the new server
1. Set up the new ZCS Server:
- change the hostname as the old server
- change the network settings as the old server
- double check all other network settings work too (e.g. DNS), firewall, SELinux is stopped.
2. Download a version of ZCS on the new server. (The zcs version must be the same as the one on the source server).
3. As root, run the installer with the -s option:
That will only install the software packages.
4. When the install.sh -s completes, you can delete the /opt/zimbra directory.
rm -rf /opt/zimbra
5. Now, copy the /opt/zimbra directory backup we made in step 5, to the new server in /opt directory, so that the structure is the same
If you have copied it to a different server, just rsync it to the new server. If you used external disk, mount it and as root rsync your backup to the new location:
6. After to copy has finished, as root run:
/opt/zimbra/libexec/zmfixperms -e -v
7. As root rerun the installer without the -s option:
The installer will detect ZCS already installed, and will ask if you want to upgrade. Select Yes.
According to bug 102962, if after the move, you are doing an upgrade to ZCS 8.7, the following post-upgrade commands must be run:
zmprov mcf zimbraMtaCommandDirectory /opt/zimbra/common/sbin zmprov mcf zimbraMtaDaemonDirectory /opt/zimbra/common/libexec zmprov mcf zimbraMtaMailqPath /opt/zimbra/common/sbin/mailq zmprov mcf zimbraMtaManpageDirectory /opt/zimbra/common/share/man zmprov mcf zimbraMtaNewaliasesPath /opt/zimbra/common/sbin/newaliases zmprov mcf zimbraMtaSendmailPath /opt/zimbra/common/sbin/sendmail
There are different methods of moving zcs to another server (apart from this one). Some of them include: