Page 1 of 15 12311 ... LastLast
Results 1 to 20 of 294

Thread: How-to: cPanel to DA migration

  1. #1
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    8,130

    How-to: cPanel to DA migration

    As we're getting more and more questions on how to use https://forum.directadmin.com/showth...613#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/showthr...460#post296460

    ---
    Known issues:
    * RoundCube data is converted from sqlite (like ./homedir/etc/domain.com/user.rcube.db) just since version 0.0.14, make sure you run the latest.
    * 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/us...limits.630671/), is sometime shortens the username part in from of it. cPanel allows myusername_ to have a DB username with myuserna_. DA DB names/usernames always start with myusername_, changing this would create a mess, for example, you could have myuserna user owning myuserna_db1 and myusername user owning myserna_db2. 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
    * JetBackup format doesn't include cpmove-user directory inside, so, for now these need to be converted manually, like (would store converted backup in /home/admin/converted_user_backup):
    Code:
    jetbackup=yes /usr/local/directadmin/scripts/cpanel_to_da/cpanel_to_da.sh /home/admin/user_backups/cpmove-USERNAME.tar.gz /home/admin/converted_user_backup
    chown -R admin. /home/admin/converted_user_backup
    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 increase it in DA to 16, for example, you can simply run:
    Code:
    /usr/local/directadmin/directadmin set max_username_length 16 restart
    * 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
    * If you have user.tar.gz instead of cpmove-user.tar.gz, it will not work! pkacct forms cpmove-users.tar.gz. If you have a list of user.tar.gz files, and want to rename them all in current directory:
    Code:
    for i in `ls *.tar.gz | grep '^[A-Za-z0-9]*.tar.gz'`; do { mv -vf ${i} cpmove-${i}; }; done
    * If you have backup-...._user.tar.gz instead of cpmove-user.tar.gz, it will not work! pkacct forms cpmove-users.tar.gz. If you have a list of backup-...._user.tar.gz files, and want to rename them all in current directory:
    Code:
    for i in `ls backup-[0-9]*.*.tar.gz`; do { USERNAME=`echo $i | cut -d_ -f3 | cut -d'.' -f1`; mv -v $i cpmove-${USERNAME}.tar.gz; }; done
    * If you don't see the user in "Move users between resellers" list, please apply: https://help.directadmin.com/item.php?id=251
    * If you did not restore resellers first, all users were assigned to "admin". If you want to re-assign them to correct resellers after restore:
    Code:
    cd /home/admin/all_backups
    for i in `ls user*.tar.gz`; do { RESELLER=`echo $i | cut -d. -f2`; USER=`echo $i | cut -d'.' -f3`; /usr/local/directadmin/scripts/move_user_to_reseller.sh $USER admin $RESELLER; }; done
    echo "action=cache&value=showallusers" >> /usr/local/directadmin/data/task.queue
    /usr/local/directadmin/dataskq d
    ---

    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@your_directadmin_server.com:/home/admin/all_backups/
    We're done with cPanel server now. Let's connect to DirectAdmin server now.

    DirectAdmin server:
    1) Make sure your DirectAdmin version is at least 1.57.4 (as of time of writing, pre-release: https://help.directadmin.com/item.php?id=408), make sure backups at /home/admin/all_backups are owned by "admin" and that you have latest version of convertor script
    Code:
    cd /usr/local/directadmin/custombuild
    ./build update
    ./build cpanel_to_da
    chown -R admin. /home/admin/all_backups
    2) We finally have DirectAdmin backups in /home/admin/all_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/all_backups" directory.

    That's it!

    -----
    If you have enough of space, I'd suggest leaving /home/admin/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:
    Code:
    ssh-keygen
    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/admin/all_backups/cpmove-${user}.tar.gz; rm -f /home/all_backups/cpmove-${user}.tar.gz ; }; done
    Last edited by smtalk; 08-13-2019 at 07:53 AM. Reason: Just formatting things :)
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  2. #2
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    8,130
    Manual for a single-user (or couple users) transfer, to test it

    Steps on cPanel server:
    1) Backup the user to /home/user_backups, replace "username" with a real username:
    Code:
    /scripts/pkgacct username /home/user_backups;
    2) Transfer whole /home/user_backups/ to DirectAdmin server:
    Code:
    rsync -avt /home/user_backups/ root@your_directadmin_server.com:/home/admin/converted_user_backup/
    Done, now we need to connect to DirectAdmin server.

    Steps on DirectAdmin server:
    1) Make sure DirectAdmin version is at least 1.57.4 (as of time of writing, pre-release: https://help.directadmin.com/item.php?id=408).
    2) Make sure your backup is owned by admin user and that you have latest version of convertor script:
    Code:
    cd /usr/local/directadmin/custombuild
    ./build update
    ./build cpanel_to_da
    chown -R admin. /home/admin/converted_user_backup
    3) Restore it in "Admin Backup/Transfer" section on DA admin level (don't forget to set the path to /home/admin/converted_user_backup, otherwise you won't see the backup)

    That's it!
    Last edited by smtalk; 07-09-2019 at 09:48 AM.
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  3. #3
    Join Date
    Nov 2010
    Posts
    55
    Exactly what I am looking for. I am migrating my remaining accounts from cPanel to DirectAdmin.

  4. #4
    Join Date
    Jun 2019
    Posts
    2
    Thanks for the added details! Do you by chance have a link or few on how to create plugins/addons for DA? I need to write up a few manager plugins for Memcached/Redis/NodeJS before making the switch over from cPanel.

  5. #5
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    8,130
    Please note NodeJS selector is fully supported and with GUI if you run CloudLinux Redis is also publicly available, might need modifications though (haven't tried it personally): https://github.com/kbentlage/da-redis-management

    I would suggest checking "CustomBuild" plugin as the best functional example: http://www.custombuild.eu/plugin/custombuild.tar.gz. It has native Vue integration with Evolution skin.

    "Hello world" example is here: https://help.directadmin.com/item.php?id=290

    DirectAdmin also supports "widgets" and "widget-only" plugins. "Vue widget only" example https://forum.directadmin.com/showthread.php?t=57994. Another example without vue (displayed as iframe): https://forum.directadmin.com/showthread.php?t=43292.
    Last edited by smtalk; 06-29-2019 at 03:14 AM.
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  6. #6
    Join Date
    Jun 2019
    Posts
    2
    Awesome, thanks for all the info!

  7. #7
    Join Date
    Oct 2015
    Posts
    40
    PLEASE MAKE A SOLUTION FOR IMPORT BACKUPS FROM NORMAL CPANEL USERS OR SOMETHING CAUSE AS FOR ME I HAVE RESELLER AND I WANT TO TRANSFER ALL TO DA, can you make import tool ? like plesk have or ispmanager? for easier migration? and think about reseller users as well

  8. #8
    Join Date
    Dec 2005
    Location
    The Netherlands
    Posts
    119
    Quote Originally Posted by lolfust1 View Post
    PLEASE MAKE A SOLUTION FOR IMPORT BACKUPS FROM NORMAL CPANEL USERS OR SOMETHING CAUSE AS FOR ME I HAVE RESELLER AND I WANT TO TRANSFER ALL TO DA, can you make import tool ? like plesk have or ispmanager? for easier migration? and think about reseller users as well
    THEY ARE WORKING ON THIS!

    For now this is the only way, your can post a topic here to hire someone to do the migration for you if you dont have the access/knowledge.

  9. #9
    Join Date
    Oct 2015
    Posts
    40
    plus please dont ever change your pricing! not sale out! keep yourself as yourself! and we proud of the module pricing you created long ago! people will appreciate it always if you stay the same

  10. #10
    Join Date
    Jul 2013
    Posts
    199
    Glad that we used from day one (9 years ago) DirectAdmin on all our servers, never considered cPanel.
    I want to wish the old Cpanel users all the best with the migration and welcome them to the DA forum

  11. #11
    Join Date
    Jun 2019
    Posts
    1

    Unhappy emails not visible after migration - mdbox

    * cPanel mdbox format email transfer has not been tested
    mdbox email does not appear to be migrated successfully.

    The email accounts are present and the disk usage shows correctly however when logging in via webmail or a mail client the emails do not show, mailbox is empty.

    Any ideas?

  12. #12
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    8,130
    Quote Originally Posted by dan-ukd View Post
    mdbox email does not appear to be migrated successfully.

    The email accounts are present and the disk usage shows correctly however when logging in via webmail or a mail client the emails do not show, mailbox is empty.

    Any ideas?
    Would you mind creating a ticket at tickets.directadmin.com with access details? We'd check for possible solutions for mdbox. This is not the default in cPanel I guess?
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  13. #13
    Join Date
    Feb 2007
    Posts
    44
    Might be easier to convert them first back to maildir on the cPanel server as it's built in?

  14. #14
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    8,130
    Quote Originally Posted by nick-a View Post
    Might be easier to convert them first back to maildir on the cPanel server as it's built in?
    This would do the trick!
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  15. #15
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    8,130
    "Admin Backup/Transfer" feature should be able to restore cpmove-username.tar.gz files directly with pre-release binaries: https://forum.directadmin.com/showth...494#post296494
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  16. #16
    Join Date
    Jul 2017
    Location
    Murfreesboro
    Posts
    353
    I seem to remember this from before but I have a issue with subdomains. The cPanel file all came over good and converted. All the data is there. The ssl certs even created fine. When try to go to the subdomain like files.domain.com it goes to domain.com but shows files.domain.com in address bar.

    I checked A records I have them. if I go to the full path domain.com/files I get forbidden htaccess issue.. thoughts?
    Thanks,
    Brent Dacus
    Just a regular guy from Tennessee

    CentOS 7 | DA | CB 2.0 | MariaDB 10.4 | PHP 7.2

    help me...it's HERE or Type "your issue your os directadmin" in google


  17. #17
    Join Date
    Jul 2019
    Posts
    3
    Does the import script keep the owner of hosting account and reseller ?

    Does it change anything in zonefile?

  18. #18
    Join Date
    Jul 2019
    Posts
    1

    Issue when converting

    Converting film (/home/user_backups/cpmove-film.tar.gz)...
    Found previous /home/admin/converted_user_backup/film. Removing...
    tar (child): /home/user_backups/cpmove-film.tar.gz: Cannot open: Not a directory
    tar (child): Error is not recoverable: exiting now

    gzip: stdin: unexpected end of file
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now
    Failed to extract /home/user_backups/cpmove-film.tar.gz to /home/admin/converted_user_backup/film_cpanel_to_convert


    Please help

  19. #19
    Join Date
    Jul 2017
    Location
    Murfreesboro
    Posts
    353
    Quote Originally Posted by bdacus01 View Post
    I seem to remember this from before but I have a issue with subdomains. The cPanel file all came over good and converted. All the data is there. The ssl certs even created fine. When try to go to the subdomain like files.domain.com it goes to domain.com but shows files.domain.com in address bar.

    I checked A records I have them. if I go to the full path domain.com/files I get forbidden htaccess issue.. thoughts?
    ok I did ./build all d
    and ./build rewrite_confs

    That fixed
    the full path domain.com/files I get forbidden htaccess issue
    if I follow this https://help.directadmin.com/item.php?id=416

    it resolves out on my dns side to files.domain.com with correct ip.
    Thanks,
    Brent Dacus
    Just a regular guy from Tennessee

    CentOS 7 | DA | CB 2.0 | MariaDB 10.4 | PHP 7.2

    help me...it's HERE or Type "your issue your os directadmin" in google


  20. #20
    Join Date
    Jul 2017
    Location
    Murfreesboro
    Posts
    353
    Ok based on current research I am leaning towards a DNS issue/ difference. Looks like DA requires a separate zone file for all subdomains. Working through that now.
    Thanks,
    Brent Dacus
    Just a regular guy from Tennessee

    CentOS 7 | DA | CB 2.0 | MariaDB 10.4 | PHP 7.2

    help me...it's HERE or Type "your issue your os directadmin" in google


Page 1 of 15 12311 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •