To move the mail server to another machine, you need to do the following:
- Prepare a new box with a mail server using H-Sphere installer.
- Using E.Manager, 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).
- Log into control panel server as root.
- Stop the Control Panel.
- In the H-Sphere database run the following command:
update l_server set p_server_id=[new_p_server_id] where id=[id_of_mail_logical_server];
(1 record)
update l_server_ips set ip='[new_mail_server_IP]', mask='[new_mail_server_mask]' where l_server_id=[id_of_mail_logical_server] and flag=4;
(1 record)
select * from l_server_ips where l_server_id=[id_of_mail_logical_server] and flag in (5,6);
- Log into your old mail server from the cp server:
su-l cpanel
ssh root@OLD_MAIL_SERVER_IP
- Move directories from the old to a new mail server:
/hsphere/local/var/vpopmail/domains/
/hsphere/local/var/vpopmail/etc/
/var/qmail
To move directories, you can run the following commands:
rsync -arzgop -e ssh /hsphere/local/var/vpopmail/domains/ root@New_Mail_Server_IP:/hsphere/local/var/vpopmail/domains/
rsync -arzgop -e ssh /hsphere/local/var/vpopmail/etc/ root@New_Mail_Server_IP:/hsphere/local/var/vpopmail/etc/
rsync -arzgop -e ssh /var/qmail root@New_Mail_Server_IP:/var/qmail
You may also want to run queue-fix
on a new mail server to rescue queued mail:
queue-fix /var/qmail/queue
- Log off the old mail server.
- Log into a new mail server by running:
ssh root@NEW_MAIL_SERVER_IP
- Check if vpopmail user ID and group ID have changed:
1) create test.test domain:
/hsphere/local/var/vpopmail/bin/vadddomain test.test
2) check new vpopmail user id (UID):
tail -3 /var/qmail/users/assign
The result should contain the following 3 lines:
your.domain.com-:your.domain.com:110:100:/hsphere/local/var/vpopmail/domains/your.domain.com:-::
+test.test-:test.test:399:399:/hsphere/local/var/vpopmail/domains/test.test:-::
.
Where 110 - old vpopmail user id (UID) 100 - old vchkpw group id (GID)
399 - new vpopmail user id (UID) 399 - new vchkpw group id (GID)
If vpopmail user ID/vchkpw group ID is changed:
- change group ID for group vchkpw:
/usr/sbin/groupmod -g GROUP_ID vchkpw
example: /usr/sbin/groupmod -g 399 vchkpw
- change user ID for vpopmail
/usr/sbin/usermod -u USER_ID -g GROUP_ID vpopmail
example: /usr/sbin/usermod -u 399 -g 399 vpopmail
- change permissions for all copied files that belong to the vpopmail user:
find / -user vpopmail -exec chown vpopmail:vchkpw {} \;
- in the file /var/qmail/users/assign change vpopmail user IDs/vchkpw group IDs to new IDs similar to the 2nd line of the result above;
- delete test.test virtual mail domain:
/hsphere/local/var/vpopmail/bin/vdeldomain test.test
- create test.test domain again:
/hsphere/local/var/vpopmail/bin/vadddomain test.test
- restart qmail
- Send a test email to postmaster@[your_service_zone] to see if your mail service is up and running.
- Start the Control Panel.
|