cPanel to DirectAdmin Migration
Recently cPanel announced massive price hike and customers were hot at all happy with this change. Many customers already started migration to alternative control panel and others are looking for possible migration. Today we will discussion how to perform cPanel to DirectAdmin migration.
For small web hosts or resellers, this change will affect their business and it will also affect their monthly budgets. DirectAdmin has possible migration option and you can migrate your cPanel accounts to DirectAdmin.
Before you decide to migrate, there are few limitation or known issues migrating from cPanel accounts to DirectAdmin.
Following are the known issues in this migration:
- cPanel mdbox format email transfer has not been tested
- Mailman mailing lists do not get converted to majordomo mailing lists
- 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, 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:
WARNING! us_wordpress cannot be owned by user, renaming database user to user_wordpress
Other things to take into consideration:
- 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 using the following command:
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 to migrate single cPanel user to DirectAdmin) to make sure you have the nameservers you need and that you don’t hit any limitations.
Migration steps to transfer ALL cPanel accounts 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):
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:
rsync -avt --delete /home/all_backups/ root@your_directadmin_server.com:/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
mkdir -p /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
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.
There may be changes in the above steps if there is any change in cPanel or DirectAdmin. You can refer the official thread from the following URL:
https://forum.directadmin.com/showthread.php?t=58059
Even if you can migrate all data successfully, it is recommended to keep the old server for few days to ensure there is no other issues. If you cannot retain the old server, you should at least keep the full backup of all accounts for few days.