How to Move All Accounts from cPanel to DirectAdmin


Migrating hosting accounts from cPanel to DirectAdmin may seem daunting, but with the right steps, you can ensure a smooth transition. This guide walks you through the process of transferring all accounts from a cPanel server to a DirectAdmin server.


Step 1: Create Backups on the cPanel Server

The first step is to create backups of all cPanel accounts. Follow these steps:

  1. Create a directory for backups
    Make sure there’s enough space on your cPanel server. If storage is limited, consider offloading backups as detailed in the “Suggestions” section below. Run the following command to create a backup directory: mkdir -p /home/all_backups
  2. Generate backups for all accounts
    Use the pkgacct script to create backups for each account and save them in the /home/all_backups directory: for user in `ls /var/cpanel/users/`; do { /scripts/pkgacct ${user} /home/all_backups; }; done This script will iterate through all cPanel users and generate backups for each account.

Step 2: Transfer Backups to the DirectAdmin Server

Once backups are ready, transfer them to your DirectAdmin server using rsync:

  1. Transfer the backups
    Replace [your_directadmin_server.com] with the hostname or IP address of your DirectAdmin server: rsync -avt --delete /home/all_backups/ root@[your_directadmin_server.com]:/home/admin/all_backups/ The rsync command ensures all files are securely copied to the DirectAdmin server.
  2. Verify transfer completion
    Double-check that all backup files have been successfully transferred to /home/admin/all_backups on the DirectAdmin server.

Step 3: Prepare Backups on the DirectAdmin Server

  1. Change ownership of the backup files
    Ensure the backups in /home/admin/all_backups are owned by the “admin” user. Run: chown -R admin. /home/admin/all_backups
  2. Verify backup ownership
    Use the ls -l command to confirm that the files are now owned by admin.

Step 4: Restore Backups in DirectAdmin

DirectAdmin provides an easy way to restore backups via its Admin Backup/Transfer section:

  1. Log in to DirectAdmin
    Access your DirectAdmin server as the “admin” user.
  2. Navigate to Admin Tools Section
    • Go to the Admin Tools section.
    • Open Admin Backup/Transfer.
  3. Restore backups
    • Set the Backup/Restore Settings (default settings are usually sufficient).
    • Specify /home/admin/all_backups as the source directory.
    • Select the backups you want to restore, or choose to restore all accounts.
  4. Start the restore process
    DirectAdmin will process the backups and restore all accounts.

Conclusion

Congratulations! You’ve successfully migrated all accounts from cPanel to DirectAdmin. This method ensures a safe and reliable transfer of data.


Additional Suggestions

If your cPanel server has insufficient space for backups, consider these alternatives:

  • Mount an external drive: Temporarily mount additional storage for the backups.
  • Transfer backups incrementally: Use rsync to move completed backups to the DirectAdmin server as they are created.

Feel free to comment below if you have any questions or need assistance. Happy hosting! 😊