Mail Server/IP Migration

 

Related Docs:   Understanding Mail Server Configuration

Before the migration, it is highly recommended to update to the latest H-Sphere version.

To move the mail server to another machine, you need to do the following:

Step 1. Prepare Servers

  1. Prepare a new box with a mail server using H-Sphere installer.
  2. Create a new physical server and add a mail server group (or add this group to the physical server you are planning to move mail server to).
  3. Disable signup for the mail server.

Step 2. Move Mail Content

  1. As the cpanel user, ssh to your target mail server:
    ssh root@<TARGET_MAIL_SERVER_IP>
  2. Move the following directories from the source to the target mail server:
    rsync -arzgop -e ssh root@<SOURCE_MAIL_SERVER_IP>:/hsphere/local/var/vpopmail/domains/ /hsphere/local/var/vpopmail/domains/
    rsync -arzgop -e ssh root@<SOURCE_MAIL_SERVER_IP>:/hsphere/local/var/vpopmail/etc/ /hsphere/local/var/vpopmail/etc/
    rsync -arzgop -e ssh root@<SOURCE_MAIL_SERVER_IP>:/var/qmail/control/ /var/qmail/control/
    rsync -arzgop -e ssh root@<SOURCE_MAIL_SERVER_IP>:/var/qmail/users/ /var/qmail/users/
    rsync -arzgop -e ssh root@<SOURCE_MAIL_SERVER_IP>:~mysql/horde/ ~mysql/horde/
    rsync -arzgop -e ssh root@<SOURCE_MAIL_SERVER_IP>:~mysql/spamassassin/ ~mysql/spamassassin/

    Step 3. Update System Database

    1. Stop the Control Panel.

    Step 4. Update Reseller's Server Aliases

    As the cpanel user, run the following java tool:

    java psoft.hsphere.tools.ServerAliasesRenamer --lserver <MAIL_LOGICAL_SERVER_ID>

    Step 5. Mail Content Final move

    1. Stop the mail and mysql service on the source server
    2. As the cpanel user, ssh to your target mail server:
      ssh root@<TARGET_MAIL_SERVER_IP>
    3. Repeat rsync commands from Step 2 from the target server
    4. rsync -arzgop -e ssh root@<SOURCE_MAIL_SERVER_IP>:/hsphere/local/var/vpopmail/domains/ /hsphere/local/var/vpopmail/domains/
      rsync -arzgop -e ssh root@<SOURCE_MAIL_SERVER_IP>:/hsphere/local/var/vpopmail/etc/ /hsphere/local/var/vpopmail/etc/
      rsync -arzgop -e ssh root@<SOURCE_MAIL_SERVER_IP>:/var/qmail/control/ /var/qmail/control/
      rsync -arzgop -e ssh root@<SOURCE_MAIL_SERVER_IP>:/var/qmail/users/ /var/qmail/users/
      rsync -arzgop -e ssh root@<SOURCE_MAIL_SERVER_IP>:~mysql/horde/ ~mysql/horde/
      rsync -arzgop -e ssh root@<SOURCE_MAIL_SERVER_IP>:~mysql/spamassassin/ ~mysql/spamassassin/
    5. Start the mysql service if you have a mysql service on the source box.

    Step 6. Enable Qmail Forwarding For The Time of DNS Propagation

    The possibility to use POP3-before-SMTP and SMTP AUTH Authentication for the time of migration has been implemented since mail2-all4. If your H-Sphere uses an older mail package, please skip this step.

    1. Start source mail server with the "forward" parameter:
      /etc/init.d/qmaild forward
      When prompted "Enter IP address of the destination mail server: ", enter the IP of the target physical server. This IP will be added to files
      /var/qmail/control/destip and /var/qmail/control/smtproutes and will be used for further server restarts.
    2. On the target mail server, add the IP of the source server as an IP with open relay.
    NOTE:
    qmail forward switches the source SMTP server into relay mode and forwards POP3 traffic to the target server with simultaneous POP3-before-SMTP authentication on the source box. This is done to keep using the old box until the target server's DNS settings are propagated across the Internet. It usually takes up to 2 or 3 days. After that, you can stop the source server.

    Step 7. Change the A DNS record for main zone.

    Go to the E-Manager -> DNS Manager and delete the A DNS record with the old IP and add it with the new IP.

    Step 8. Finish Off The Migration

    1. Check if you have ~qmaild/control/outgoingip file. If yes, change the IP in this file to the new one.
    2. Restart qmail service on the target box.
    3. On CP server, check the ~cpanel/shiva/psoft_config/hsphere.properties file. Here, find the SMTP_HOST parameter. If it is set to the old mail server IP, reset it to the new IP or to the SMTP server's hostname.
    4. If SMTP_HOST parameter was changed, restart the Control Panel.

    Step 9. Check mail server functionality.


Related Docs:   Understanding Mail Server Configuration







Home   Products   Services   News
© Copyright. . PSOFT. All Rights Reserved. Terms | Site Map