Command disabled: backlink

Move Mailserver

From time to time, it may be needed to move to a new server. Either because the old hardware is to old, or something really bad happened to the old server.

In this example, we're moving from oldserver to newserver.

Installation & Licensing

  1. Install the new server, either from the latest VMware image or using any of the ISO images available from http://updates.allardsoft.com. newserver needs to install the same version as oldserver.
  2. Give newserver the same hostname as oldserver and install the license from oldserver (this assumes that oldserver will be decommissioned when this has completed).
  3. After the license has been installed, the hostname can be changed as required.
  4. Enable console access on newserver.

Configuration

Almost all configuration is stored in the MySQL database (less some system configuration and manual tweaks that has to be set manually).

oldserver:

/usr/local/bin/mysqldump --all-databases --force 2>/dev/null | gzip -9 > /var/tmp/mysql.sql.gz
scp /var/tmp/mysql.sql.gz newserver:/var/tmp
scp /etc/ssl/server.crt newserver:/etc/ssl/server.crt
scp /etc/ssl/private/server.key newserver:/etc/ssl/private/server.key

newserver:

gzip -cd /var/tmp/mysql.sql.gz | mysql
rm /var/tmp/mysql.sql.gz
mailserver db:migrate

This last step updates the database schema if newserver is running a later version than oldserver.

Mail data

All the mail data is stored in the directory /var/mailserver and can be copied as is:

oldserver:

gtar zcfp - /var/mailserver | ssh root@newserver 'gtar zxvfp - -C /'

newserver:

mailserver fix_permissions

All mails and all configuration has now been migrated to the new server and the old server can now be decommissioned.

mailserver/move_server.txt · Last modified: 2010-05-10 21:14 by allard