Migrating from Plesk 9.5 to Plesk Onyx 17.0 on Linux

I recently migrated from a dedicated server running CentOS 5 and Plesk 9.5 to a virtual server running CentOS 7 and Plesk Onyx 17.0. The new server is running on an EC2 instance at Amazon. Here are my notes.

Plesk Installation

The first error I encountered was during the installation of Plesk. During the install I got this error:

Exception: Failed to solve dependencies:
psa-mail-driver-common-17.0.17-cos7.build1700161124.17.x86_64 requires libopendkim.so.10()(64bit)

ERROR: The Yum utility failed to install the required packages.
Attention! Your software might be inoperable.
Please contact product technical support.

Apparently CentOS 7 installs libopendkim-2.11 by default and Plesk requires version 2.10. To solve this I had to download and install libopendkim-2.10 which I found on the Plesk site:

http://parallels.bhs.mirrors.ovh.net/parallels/PSA_17.0.17/thirdparty-rpm-CentOS-7-x86_64/libopendkim-2.10.3-3.el7.x86_64.rpm

Download this file and install it with:

rpm -Uvh libopendkim-2.10.3-3.el7.x86_64.rpm

Then you can proceed with the Plesk Installation

Email Configuration

Enable port 587 for sending mail. This can be changed under Tools & Settings -> Mail Server Settings.

Make TLS optional on port 587.

1. Edit /etc/postfix/master.cf
2. Find the line that starts with “submission”
3. Change smtpd_tls_security_level to “may” instead of “encrypt”

Set queue lifetime to more sensible values by running these commands:

postconf -e “maximal_queue_lifetime=2h”
postconf -e “minimal_backoff_time=5m”
postconf -e “maximal_backoff_time=15m”
postconf -e “queue_run_delay=5m”

Upload your SSL certificate. This is really easy do to in Plesk 17. Just go to Tools & Settings -> SSL/TLS Certificates and follow the instructions there.

Email Migration

I used the Plesk Migration Manager to migrate all the domains and users and users mailboxes to the new server. However, the Migration Manager was lacking in a couple areas. First, it did not migrate any IMAP folders. It migrated the users’ inbox but if they had any IMAP folders, those did not get migrated. The solution I found was to use rsync. I wrote a little shell script to iterate through all the Maildir folders on the new server and copy the data from the old server using rsync. Create a file called syncmail.sh on the new server and paste in this code:

#!/bin/sh
DOMAIN=$1
SOURCE_SERVER=old.servername.com

find /var/qmail/mailnames/$DOMAIN -maxdepth 2 -name Maildir >/tmp/maildirs.txt

while read MAILDIR; do
echo “Syncing $MAILDIR”
rsync -av –delete $SOURCE_SERVER:$MAILDIR/ $MAILDIR/
done </tmp/maildirs.txt

This script syncs one domain at a time so you need to specify the domain name as the first argument when running the script. But you could change it to do all domains at once by leaving the domain name blank and changing maxdepth to 3. This not only copies the IMAP folders but it also syncs any changes made to the inbox on the old server such as new messages that have arrived or messages the user may have deleted. You can run this script as many times as you want and it will only copy the changes.

The second major flaw with the migration manager is that it doesn’t preserve the UID of each message. The UID is how Outlook and other mail clients determine which messages have already been downloaded. So if you don’t preserve the UID’s from the old server, Outlook will re-download all the messages again and you will have lots of users with lots of duplicate emails. I think the reason it didn’t preserve the UID’s is because the old server was using Courier-IMAP and the new server was using Dovecot. Luckily I found a utility online that can convert the UID’s from Courier to Dovecot. You can download it from http://wiki.dovecot.org/Migration/Courier. To use the script just do this on the new server after the mailbox has been copied over:

courier-dovecot-migrate.pl –to-dovecot –convert $MAILDIR

Where $MAILDIR is the location of the users Maildir folder. (/var/qmail/mailnames/domain.com/user@domain.com/Maildir). I even incorporated this step into the syncmail.sh script right after the rsync command like this:

#!/bin/sh
DOMAIN=$1
SOURCE_SERVER=old.servername.com

find /var/qmail/mailnames/$DOMAIN -maxdepth 2 -name Maildir >/tmp/maildirs.txt

while read MAILDIR; do
echo “Syncing $MAILDIR”
rsync -av –delete $SOURCE_SERVER:$MAILDIR/ $MAILDIR/
courier-dovecot-migrate.pl –to-dovecot –convert $MAILDIR
done </tmp/maildirs.txt

So now the script copies (syncs) all the email from all the Maildir folders on the old server to the new server and then converts the Courier-IMAP files into the format expected by Dovecot so all the UID’s are the same. Brilliant!

The overall process went something like this:

  1. Use the Migration Manager to do the initial copy. That gets all the users setup on your new server with the same passwords as before.
  2. Use the script to copy over the rest of the mailbox data for each domain.
  3. Disable mail on the old server. I blocked all the mail-related ports (25,110,143,587,465,993 & 995) so that no new messages could come in and users could no longer connect to the old server
  4. Run the script again to pickup any last minute changes
  5. Change your hostname and MX records to point to the new server.

I didn’t want to go around and change the incoming and outgoing mail server settings in every mail client and smartphone, so I just pointed my old hostname to the new server’s IP address.

Website Migration

The Migration Manager did a good job of copying all the website files and databases from the old server to the new server

 

 

 

 

 

 

Tags:

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *