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.
newserver needs to install the same version as oldserver.newserver the same hostname as oldserver and install the license from oldserver (this assumes that oldserver will be decommissioned when this has completed).newserver.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.
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.