Migrating Zimbra 7 from CentOS 5 to Zimbra 8 on CentOS 6 – The definitive guide.

2

October 4, 2012 by aubreykloppers

Earlier I wrote on the steps needed to create a successful migration of Zimbra from Centos5 to Centos6.  I am doing this on a SPLIT-DNS environment and will end up having 2 Zimbra Server.  So-far my steps are as follows:

(I am using ESXi 4.1, but ESXi 5 would also do)

Preparing the system:

  1. Create a new VM called Zimbra8 with initial disk space of 25G.
  2. Install CentOS 6.4
  3. Boot system and add proxy info to /etc/yum.conf (Add to last line “proxy=http://<IP>:<PORT>”
  4. Install: “yum -y install bind bind-utils nc”
  5. Download and install webmin: “yum install webmin(release).rpm” and start webmin server.
  6. Disable POSTFIX and FIREWALL. (This can be done in WEBMIN)
  7. Fix network and named configurations.  (Copied from old Server, just change the INTERNAL IP NUMBERS.)
  8. Generate rndc key: “rndc-confgen -a”.

NOTE: Webmin:

Using the Webmin YUM repository

If you like to install and update Webmin via RPM, create the /etc/yum.repos.d/webmin.repo file containing :[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1
You should also fetch and install my GPG key with which the packages are signed, with the commands :wget http://www.webmin.com/jcameron-key.asc
rpm --import jcameron-key.asc
You will now be able to install with the command :yum install webminAll dependencies should be resolved automatically.

At this stage everything was running 100% and DIG working as it should.  I then:

  1. Took down the server and created an OVA template from the server.  (1.7G in size.)
  2. Added a new virtual-disk (700G) to the system.
  3. Boot the system and added the additional disk: “fdisk /dev/sdb”  (After finding the disk with “ls /dev/sd*”) and doing a n/p/1/w.  (See my post https://aubreykloppers.wordpress.com/2012/07/01/openmediavault-initialize-3tb-disks/)
  4. Created a new ext4 file system with: “mkfs.ext4 -L store /dev/sdb1”
  5. Mounted the disk on /opt/zimbra. (Using “webmin/system/disk and network filesystems” and creating a mount-point)

OK, this got me to a stage where I am ready to do a fresh install of Zimbra for migration purposes.

NOTE: From this stage onward, no SNAPSHOTS or OVF files will be created.  This is due to the fact that (1)The system now has a 700G disk attached and (2)The moving of the old system will take HUGE amounts of disk-space.

Installing Zimbra:

NOTE: I am using Zimbra 7.1.3 on both servers.

  1. Extract zimbra archive with: “tar -zxvf zcs<release you downloaded>.tgz”
  2. cd to the extracted directory.
  3. Run: “./install –platform-override –skip-activation-check”
  4. NOTE: At this stage I was missing out on libstdc++.so.6 and ran: “ln -s /usr/lib64/libstdc++.so.6.0.13 /usr/lib/libstdc++.so.6” to rectify it.  Reran POINT 4.
  5. Got a warning that /opt/zimbra exists and ignored it. (Not to delete it…)
  6. Answered all the questions and the installation started ok.
  7. Entered my domain-name and the post-installation-tasks came up.
  8. Changed password (make it password initially to not having to hassle later on, you can always change it in the console) and applied my license.

NOTE: Regarding your Domain Name.  If you configured your mail server as mail.domain.com, your domain is domain.com.  NOT mail.domain.com!

At this stage the system came up as it should.

  1. Signed on as admin/password and changed my password to a secure one: “https://<IP&gt;:7071”.
  2. The system showed everything as down, although running: “zmcontrol status” showed everything up-and-running.  I believe this is due to the license not being verified, but I will leave this for last.  (In case I need to re-load the system from scratch.)
  3. One of the things I forgot to do was change the access rights on /opt/zimbra and did so by: “chown zimbra zimbra” and “chgrp zimbra zimbra” in the /opt directory.  Failing to do so leaves a whole lot of missing items on the interface.
  4. I then stopped the zimbra services with: “zmcontrol stop” and created a directory with “mkdir /opt/old.zimbra”
  5. I did a rsync (to keep the new installation) with: “rsync -azvp /opt/zimbra/ /opt/old.zimbra/” as I am going to overwrite this with the old zimbra server.
  6. I then deleted everything in /op/zimbra.
  7. Rebooted the system.

OK, this left me with a skeleton Zimbra Server with no data of any sorts.  The server is now ready to receive data.

Transferring data from the OLD Zimbra Server to the NEW Zimbra Server:

Script used to transfer the data:

[root@mail ~]# more /scripts/backup.sh
rsync -avHK –delete –force /scripts/ root@<destination IP>:/scripts/
rsync -avHK –delete –force /opt/zimbra/ root@<destination IP>:/opt/zimbra/

  • The above script will prompt you for a password on every command.  This is so that if I forgot something, I get stopped.  (I have a directory full of scripts to manage the system that gets copied with the first line.)
  • It is also very easy to interrupt with CTRL+C.
  • The mailboxes (stored in /opt/zimbra/store) will take a long time (on a big system) to transfer.  My OLD server takes about an hour to “building file list …” to complete before starting the transfer.  (I have about 380G space in use on my mailboxes.)

I will continue this posting in about 3 days, when the transfer of data completed.

Reminder:

Check if NAMED SERVICE gets started at bootup once the rcync completed.  If not, start it (you can do this in WEBMIN). 

At this stage I ran into an LDAP error and was able to correct it with:

Dump the old ldap data on the old server
/opt/zimbra/libexec/zmslapcat /tmp/

Remove the default ldap data on the new server
rm -rf /opt/zimbra/data/ldap/hdb/*

Create the db and logs folders
mkdir -p /opt/zimbra/data/ldap/hdb/db /opt/zimbra/data/ldap/hdb/logs

Fix the permissions (make zimbra the owner of the ldap data)
chown -R zimbra\: /opt/zimbra/data/ldap

Import the old ldap data into your new ldap server
/opt/zimbra/openldap/sbin/slapadd -q -b “” -F /opt/zimbra/data/ldap/config -cv -l /tmp/ldap.bak

Fixing PostMap:

ran: postmap /opt/zimbra/postfix/conf/transport

recreated the self-signed crt:

  • Begin by generating a new Certificate Authority (CA).
 /opt/zimbra/bin/zmcertmgr createca -new
  • Then generate a certificate signed by the CA that expires in 365 days.
 /opt/zimbra/bin/zmcertmgr createcrt -new -days 365
  • Next deploy the certificate.
 /opt/zimbra/bin/zmcertmgr deploycrt self
  • Next deploy the CA.
 /opt/zimbra/bin/zmcertmgr deployca
  • To finish, verify the certificate was deployed to all the services.

/opt/zimbra/bin/zmcertmgr viewdeployedcrt

Upgrading from this point on was as easy as following the prompts and waiting for the system to complete…

Recovering system disk:

  1. /opt/zimbra/libexec/zmfixperms – This will fix all your permissions of your Zimbra system.  Remember to run this as ROOT.
  2. more…
Advertisements

2 thoughts on “Migrating Zimbra 7 from CentOS 5 to Zimbra 8 on CentOS 6 – The definitive guide.

  1. hI, i migrate zimbra to zimbra 7.2.2 centos 5.9 to centos 8 2 by following these steps:
    1) installed a vm centos 6
    2) installed on centos 6, zimbra 7.2.2
    3) stopped zimbra 7.2.2 on centos 5
    4) delete the / opt / zimbra on centos 6
    5) on centos 5 I moved to / opt (cd / opt) and I ran the command:
      tar-zcvf – * | ssh vmcentos6.loc ‘cd / opt / zimbra / && tar-zxf -‘
    6) on centos 6 I installed zimbra 8.
    7) reboot zimbra8

    All working perfectly! No: setting / mail / aliases / etc etc lost

    Like

  2. nehaljwani says:

    I upgraded from Zimbra 7.2.6 to Zimbra 8.0.6 and documented the steps using a screen cast:

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: