As we're getting more and more questions on how to use
https://forum.directadmin.com/showthread.php?t=52792&p=280613#post280613, I've decided to write this article to make it clear
See the 2nd post if you'd just like to try it for a single or couple accounts.
FAQ for new customers: http://forum.directadmin.com/showthread.php?t=58062&p=296460#post296460
---
Known issues:
* cPanel mdbox is supported in ver. 0.0.7, but hasn't been tested very throughly
* Mailman mailing lists do not get converted to majordomo mailing lists
* Please make sure it's you who created cpmove-user.tar.gz backup for
security purposes, because at this moment we fully trust the content inside, thus available on admin level only. This might change later.
* DirectAdmin format for mysql usernames/databases is always
username_database and
username_user. cPanel has the same format, but due to max username/database length (
https://forums.cpanel.net/threads/username-length-limits.630671/), is sometime shortens the
username part in from of it. The script converts username to be
username in such cases, so, for some accounts you might need to change database username/name in wp-config.php or other files CMS uses. This should be rare though. Script output in such cases:
Code:
WARNING! us_wordpress cannot be owned by user, renaming database user to user_wordpress
Other things to take into consideration:
* It's recommended to
leave all the
cpmove-user.tar.gz files on the system after restore. If there are bugs, or something goes wrong, it'd still be possible to recover that data.
* Like any software - there might be bugs there, if you notice any - please let us know, and we'll try fixing them as soon as possible.
* DirectAdmin supports a different feature set than cPanel. For example, DirectAdmin supports nginx/openlitespeed, MySQL8, rspamd etc., but it has no support for PostgreSQL or Ruby. So, if you have any sites using them - they'd need to be transferred manually.
* Max username length is 16 characters for MySQL users by default, and 10 for system user. Max username length can be increased in /usr/local/directadmin/conf/directadmin.conf. You can find max length of your username in cPanel easily:
Code:
ls /var/cpanel/users | awk '{print length, $0}' | sort -nr | head -n1
* To make sure your MySQL username/database name is fine, I'd suggest upgrading your MySQL/MariaDB on the server (
https://www.directadmin.com/features.php?id=2294), MySQL 5.7+ or MariaDB 10.x is recommended.
* I'd suggest trying it with 1 account first, most preferably - the one with the longest database name/username (guide for this in 2nd post) to make sure you have the nameservers you need and that you don't hit any limitations
---
MIGRATION STEPS:
Steps to transfer
ALL the accounts from cPanel server to DirectAdmin:
cPanel server:
1) Create a backup of all cPanel accounts on cPanel server and place them to /home/all_backups (make sure you have enough of space for them, if not, please read the suggestions at the end of the article):
Code:
mkdir -p /home/all_backups
for user in `ls /var/cpanel/users/`; do { /scripts/pkgacct ${user} /home/all_backups; }; done
2) Transfer /home/all_backups to DirectAdmin server:
Code:
rsync -avt --delete /home/all_backups/ root@[B]your_directadmin_server.com[/B]:/home/all_backups/
We're done with cPanel server now. Let's connect to DirectAdmin server now.
DirectAdmin server:
1) Convert all backups to DirectAdmin format, place them to /home/admin/admin_backups and set appropriate permissions for them:
a) Install converter script
Code:
mkdir -p /root/cpanel_to_da
cd /root/cpanel_to_da
wget -O cpanel_to_da.sh http://www.custombuild.eu/cpanel/cpanel_to_da.sh
chmod +x cpanel_to_da.sh
wget -O cpanel_da_roundcube.php http://www.custombuild.eu/cpanel/cpanel_da_roundcube.php.txt
wget -O php_sql_parser.tar.gz http://www.custombuild.eu/cpanel/php_sql_parser.tar.gz
tar xzf php_sql_parser.tar.gz
rm -f php_sql_parser.tar.gz
b) convert all the backups and place them to /home/admin/converted_backups
Code:
mkdir -p /home/admin/converted_backups
for i in `ls /home/all_backups/`; do { ./cpanel_to_da.sh /home/all_backups/$i /home/admin/converted_backups; }; done
chown -R admin. /home/admin/converted_backups
2) We
finally have
DirectAdmin backups in /home/admin/converted_backups
Now we can simply go to DirectAdmin "Admin Backup/Transfer" section, check "Backup/Restore Settings" (defaults should be fine) in Admin level and restore all backups from "/home/admin/converted_backups" directory.
That's it!
-----
If you have enough of space, I'd suggest leaving /home/all_backups/ still there on DA server for a couple of weeks/months, if there is something missing in DA - you'd always have it in that backup.
If your cPanel server doesn't have enough of space - it's easy transfer accounts one-by one directly to the home folder on a new server. The most convenient way to do this is to generate SSH keys on cPanel server using:
Then you'll have your public key placed in /root/.ssh/id_rsa.pub. Just copy the content of it to your DirectAdmin server, file /root/.ssh/authorized_keys (if /root/.ssh directory does not exist - create it). This will make it possible to connect to DA server without any password (from your cPanel server). Now instead of steps 1) and 2) on cPanel server, just do this:
Code:
for user in `ls /var/cpanel/users/`; do { /scripts/pkgacct ${user} /home/all_backups; rsync -avt /home/all_backups/cpmove-${user}.tar.gz root@your_directadmin_server.com:/home/all_backups/cpmove-${user}.tar.gz; rm -f /home/all_backups/cpmove-${user}.tar.gz ; }; done