How to move ZCS to another server: Difference between revisions

(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=How to move ZCS to another server=
=How to move ZCS to another server=
{{KB|{{ZC}}|{{ZCS 8.6}}|{{ZCS 8.5}}|{{ZCS 8.0}}|}}
{{KB|{{Unsupported}}|{{ZCS 8.8}}|{{ZCS 8.6}}|{{ZCS 8.0}}|}}
{{WIP}}
{{WIP}}
==Problem==
==Problem==


Line 19: Line 18:
Below are the exact steps that needs to be taken, to complete the migration:
Below are the exact steps that needs to be taken, to complete the migration:


*====On the old server:====
====On the old server:====


1. # su - zimbra
'''1'''. # su - zimbra


2. $ zmcontrol stop
'''2'''. $ zmcontrol stop


3. $ exit
'''3'''. $ exit


4. Make sure all zimbra services are stopped: # ps aux | grep zimbra  
'''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).
'''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:
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
  rsync -e ssh -axvzKHS  /opt/zimbra/ 10.0.0.1:/tmp/zimbra
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:
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
  rsync -axvzKHS /opt/zimbra /mnt/zimbra_backup


6. Install a new server, with supported Operating System for the zcs version.  
'''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
'''7'''. Turn off the old ZCS Server
  shutdown -h now
  shutdown -h now


* ====On the new server====
<br>


1. Set up the new ZCS Server:  
====On the new server====
 
'''1'''. Set up the new ZCS Server:  
* change the hostname as the old server
* change the hostname as the old server
* change the network settings 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.
* double check all other network settings work too (e.g. DNS), firewall, SELinux is stopped.
<br>
<br>
2. Download a version of ZCS on the new server. (The zcs version must be the same as the one on the source server)
'''2'''. Download a version of ZCS on the new server. (<span style="color:#FF0000">The zcs version must be the same as the one on the source server</span>).


3. As root, run the installer with the -s option:  
'''3'''. As root, run the installer with the -s option:  
  ./install.sh -s
  ./install.sh -s
That will only install the software packages.
That will only install the software packages.


4. When the install -s completes, you can delete the /opt/zimbra directory.  
'''4'''. When the install.sh -s completes, you can delete the /opt/zimbra directory.  
  rm -rf /opt/zimbra
  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
'''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
  /opt/
  /opt/zimbra/
└── zimbra


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:  
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:  
rsync -axvzKHS /mnt/zimbra_backup /zimbra /opt/.


6. As root run:
'''6'''. After to copy has finished, as root run:
  /opt/zimbra/libexec/zmfixperms -e -v
  /opt/zimbra/libexec/zmfixperms -e -v


7. As root rerun the installer without the -s option:
There is a [https://bugzilla.zimbra.com/show_bug.cgi?id=106379 bug] opened for ZCS 8.7 when you run the zmfixperms.  (<span style="color:#FF0000">The bug has been fixed in '''8.7.3''' or later versions.</span>)
  ./install.sh
 
If by mistake you run it on 8.7.2 or lower versions, the commands below should fix it:
# chown root:postdrop /opt/zimbra/common/sbin/postqueue
# chown root:postdrop /opt/zimbra/common/sbin/postdrop
# chmod g+s /opt/zimbra/common/sbin/postqueue
# chmod g+s /opt/zimbra/common/sbin/postdrop
 
# cd /opt/zimbra/common/
# chown root.root *
# chown root.zimbra conf/
# chown -R root.root libexec/
  # chown -R root.root bin/
# cd conf
# chown root.zimbra *
# chown zimbra.zimbra master.cf master.cf.in bysender bysender.lmdb  tag_as_foreign.re tag_as_foreign.re.in tag_as_originating.re tag_as_originating.re.in
# chown root.root snmp.conf main.cf
 
Run the following to check for any postfix errors. There should be no output:
postfix check




'''7'''. As root rerun the installer without the -s option:
./install.sh
The installer will detect ZCS already installed, and will ask if you want to upgrade. Select Yes.
<br>


==Additional Content==
==Additional Content==
'''A'''ccording to [https://bugzilla.zimbra.com/show_bug.cgi?id=102962 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
----
'''A''' common error that might be experienced if you move the server from Ubuntu 14 to Ubuntu 16 is:
Validating ldap configuration
/usr/bin/perl: symbol lookup error: /opt/zimbra/common/lib/perl5//x86_64-linux-gnu-thread-multi/auto/Socket/Socket.so: undefined symbol: Perl_xs_apiversion_bootcheck
Unknown Error: It should be impossible to reach this statement.
OR
Validating existing license is not expired and qualifies for upgrade
Unknown Error. It should be impossible to reach this statement.
The solution:
for pkg in $(dpkg -l | grep zimbra | grep perl | awk '{print $2}'); do sudo apt-get install --reinstall $pkg; done
----
'''If''' you are doing inplace upgrade of the OS from Ubuntu 14 to Ubuntu 16 with the '''do-release-upgrade''', you may hit [https://bugzilla.zimbra.com/show_bug.cgi?id=107436 Bug 107436 ]. Comment #15 seems like the easiest workaround for it.
----




There are different methods of moving zcs to another server (apart from this one). Some of them include:
* https://wiki.zimbra.com/wiki/How_to_merge_two_independent_ZCS_servers_into_one
* https://wiki.zimbra.com/wiki/ZCS_to_ZCS_rsync_Migration
* https://wiki.zimbra.com/wiki/Network_Edition_Disaster_Recovery




{{Article Footer|Zimbra Collaboration 8.6, 8.5, 8.0| 28/09/2016}}
{{Article Footer|Zimbra Collaboration 8.8, 8.6 | 28/09/2016}}
{{NeedSME|SME1|SME2|COPY EDITOR}}
{{NeedSME|SME1|SME2|COPY EDITOR}}

Revision as of 01:50, 14 February 2019

How to move ZCS to another server

   KB 23043        Last updated on 2019-02-14  




0.00
(0 votes)

Problem

In this article, we will explain how to move/migrate a zimbra server to another machine.


Prerequisites

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.

Resolution

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/zimbra

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:

./install.sh -s

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

/opt/zimbra/

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

There is a bug opened for ZCS 8.7 when you run the zmfixperms. (The bug has been fixed in 8.7.3 or later versions.)

If by mistake you run it on 8.7.2 or lower versions, the commands below should fix it:

# chown root:postdrop /opt/zimbra/common/sbin/postqueue
# chown root:postdrop /opt/zimbra/common/sbin/postdrop
# chmod g+s /opt/zimbra/common/sbin/postqueue
# chmod g+s /opt/zimbra/common/sbin/postdrop
# cd /opt/zimbra/common/
# chown root.root *
# chown root.zimbra conf/
# chown -R root.root libexec/
# chown -R root.root bin/
# cd conf
# chown root.zimbra *
# chown zimbra.zimbra master.cf master.cf.in bysender bysender.lmdb  tag_as_foreign.re tag_as_foreign.re.in tag_as_originating.re tag_as_originating.re.in
# chown root.root snmp.conf main.cf

Run the following to check for any postfix errors. There should be no output:

postfix check


7. As root rerun the installer without the -s option:

./install.sh 

The installer will detect ZCS already installed, and will ask if you want to upgrade. Select Yes.


Additional Content

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


A common error that might be experienced if you move the server from Ubuntu 14 to Ubuntu 16 is:

Validating ldap configuration
/usr/bin/perl: symbol lookup error: /opt/zimbra/common/lib/perl5//x86_64-linux-gnu-thread-multi/auto/Socket/Socket.so: undefined symbol: Perl_xs_apiversion_bootcheck
Unknown Error: It should be impossible to reach this statement.

OR

Validating existing license is not expired and qualifies for upgrade 
Unknown Error. It should be impossible to reach this statement. 

The solution:

for pkg in $(dpkg -l | grep zimbra | grep perl | awk '{print $2}'); do sudo apt-get install --reinstall $pkg; done


If you are doing inplace upgrade of the OS from Ubuntu 14 to Ubuntu 16 with the do-release-upgrade, you may hit Bug 107436 . Comment #15 seems like the easiest workaround for it.



There are different methods of moving zcs to another server (apart from this one). Some of them include:


Verified Against: Zimbra Collaboration 8.8, 8.6 Date Created: 28/09/2016
Article ID: https://wiki.zimbra.com/index.php?title=How_to_move_ZCS_to_another_server Date Modified: 2019-02-14



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »


Wiki/KB reviewed by SME1 SME2 COPY EDITOR Last edit by Teodor Vizirov
Jump to: navigation, search