We've received some requests to write a guide on how to migrate email-only server. First step would be to create a cPanel backup without email data, but with email accounts. Something like this might help:
https://forums.cpanel.net/threads/s...mail-accounts-and-without-public_html.264611/
You could then use the same "pkgacct" command for all the accounts, just like mentioned in https://forum.directadmin.com/showthread.php?t=58059.
When you get the account backup ready, please use https://forum.directadmin.com/showthread.php?t=58059&p=296439#post296439 to migrate it (DA might support direct cPanel backup restores in GUI soon, but CLI is the only option now).
With these steps done, please make sure you see the accounts in DirectAdmin. Then you may use rsync on your DA server to sync FROM cpanel. A script would look like this (just wrote, so, would need some testing), don't forget to change the IP:
For single account (to test), you can just run the following instead of the script for all the account (replace uppercase strings with real ones):
Example, to sync [email protected], if account name is myuser and server IP is 8.8.8.8:
Troubleshooting:
-----
If you notice any issues, these might be permissions related, to fix them:
If something is still not okay (shouldn't be), you can simply remove dovecot index files:
rm -f /home/myuser/imap/yourdomain.com/info/Maildir/dovecot*
-----
Steps:
1) Backup cPanel account without email data
2) Restore it in DirectAdmin
3) Run rsync command, wait for it to finish
4) Can do internal testing now to see if everything is here
5) You can now re-run rsync command, it'd just transfer the differences if there are any, and you're done
Thank you!
https://forums.cpanel.net/threads/s...mail-accounts-and-without-public_html.264611/
You could then use the same "pkgacct" command for all the accounts, just like mentioned in https://forum.directadmin.com/showthread.php?t=58059.
When you get the account backup ready, please use https://forum.directadmin.com/showthread.php?t=58059&p=296439#post296439 to migrate it (DA might support direct cPanel backup restores in GUI soon, but CLI is the only option now).
With these steps done, please make sure you see the accounts in DirectAdmin. Then you may use rsync on your DA server to sync FROM cpanel. A script would look like this (just wrote, so, would need some testing), don't forget to change the IP:
Code:
#!/bin/sh
#Change IP to the real one, make sure we're able to login without password to it (SSH keys)
CPANEL_SERVER_IP=8.8.8.8
for u in `ls /usr/local/directadmin/data/users`; do
{
echo "doing ${u}"
for d in `grep ": ${u}$" /etc/virtual/domainowners | cut -d: -f1`; do
{
echo "domain: ${d}";
for e in `cat /etc/virtual/${d}/passwd | cut -d':' -f1`; do {
if [ ! -d /home/${u}/imap/${d}/${e}/Maildir ]; then
mkdir -p /home/${u}/imap/${d}/${e}/Maildir
fi
rsync --delete -at root@${CPANEL_SERVER_IP}:/home/${u}/mail/${d}/${e}/ /home/${u}/imap/${d}/${e}/Maildir/
/usr/local/directadmin/scripts/set_permissions.sh maildir ${u} /home/${u}/imap/${d}/${e}/Maildir
echo "${e}@${d} has been synchronized!"
};
done;
};
done;
echo "";
};
done;
For single account (to test), you can just run the following instead of the script for all the account (replace uppercase strings with real ones):
Code:
rsync --delete -at root@YOUR_SERVER_IP:/home/USER/mail/DOMAIN/EMAIL/ /home/USER/imap/DOMAIN/EMAIL/Maildir/
Example, to sync [email protected], if account name is myuser and server IP is 8.8.8.8:
Code:
rsync --delete -at [email protected]:/home/myuser/mail/yourdomain.com/info/ /home/myuser/imap/yourdomain.com/info/Maildir/
Troubleshooting:
-----
If you notice any issues, these might be permissions related, to fix them:
Code:
/usr/local/directadmin/scripts/set_permissions.sh maildir myuser /home/myuser/imap/yourdomain.com/info/Maildir
If something is still not okay (shouldn't be), you can simply remove dovecot index files:
rm -f /home/myuser/imap/yourdomain.com/info/Maildir/dovecot*
-----
Steps:
1) Backup cPanel account without email data
2) Restore it in DirectAdmin
3) Run rsync command, wait for it to finish
4) Can do internal testing now to see if everything is here
5) You can now re-run rsync command, it'd just transfer the differences if there are any, and you're done
Thank you!
Last edited: