Category: cPanel

  • How to Migrate All cPanel Accounts to DirectAdmin


    How to Migrate All cPanel Accounts to DirectAdmin

    With cPanel license costs rising, many hosting providers are migrating to DirectAdmin as a lightweight and cost-effective alternative. DirectAdmin provides migration tools that make it possible to transfer all cPanel accounts without losing websites, databases, or emails.

    In this guide, we’ll walk through the exact steps to move all accounts from cPanel to DirectAdmin.


    Prerequisites

    Before you begin:

    • Root SSH access to both the cPanel server and the DirectAdmin server.
    • Enough free disk space to store temporary backups.
    • rsync installed (usually preinstalled on Linux).

    Step 1: Create Backups of All cPanel Accounts

    On the cPanel server, create a directory for backups:

    mkdir -p /home/all_backups
    

    Now generate backups for every cPanel user account:

    for user in `ls /var/cpanel/users/`; do { /scripts/pkgacct ${user} /home/all_backups; }; done
    

    This will create a set of backup files in /home/all_backups/, one for each cPanel account.
    Each backup will look like:

    /home/all_backups/cpmove-USERNAME.tar.gz
    

    Step 2: Transfer Backups to DirectAdmin Server

    Next, transfer all backups to the DirectAdmin server. Replace your_directadmin_server.com with your server hostname or IP:

    rsync -avt --delete /home/all_backups/ root@your_directadmin_server.com:/home/admin/all_backups/
    

    Now you can disconnect from the cPanel server — we’re done with it.


    Step 3: Fix File Ownership on DirectAdmin

    On the DirectAdmin server, make sure all transferred backups belong to the admin user:

    chown -R admin. /home/admin/all_backups
    

    Step 4: Restore Accounts in DirectAdmin

    Now restore all accounts through DirectAdmin’s admin panel:

    1. Log in as admin.
    2. Go to Admin Level → Admin Backup/Transfer → Restore.
    3. Set the path to: /home/admin/all_backups
    4. Select the accounts and click Restore.

    DirectAdmin will now restore all websites, databases, emails, and DNS settings from the converted backups.


    Step 5: Keep Backups for Safety

    It’s a good idea to leave /home/admin/all_backups on the DirectAdmin server for a few weeks or months.
    If something was missed during migration, you can easily extract it from the backup.


    Alternative Method: Limited Disk Space on cPanel Server

    If your cPanel server does not have enough space to generate all backups at once, you can migrate account by account and transfer directly to the DirectAdmin server.

    First, set up passwordless SSH access between servers:

    1. On the cPanel server, generate an SSH key: ssh-keygen (Press Enter to accept defaults).
    2. Copy the contents of /root/.ssh/id_rsa.pub to the DirectAdmin server’s file: /root/.ssh/authorized_keys (Create the /root/.ssh/ directory if it does not exist).

    Now you can loop through accounts one by one, transferring immediately after backup:

    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
    

    This method ensures only one backup exists at a time, saving disk space.


    Verification

    After migration, test:

    • Websites load correctly.
    • Databases are intact.
    • Email accounts are working.
    • DNS records are correct.

    Conclusion

    Migrating all accounts from cPanel to DirectAdmin is straightforward with the pkgacct tool and DirectAdmin’s built-in migration system.

    • If you have enough space, back up all accounts, transfer them, and restore in bulk.
    • If not, migrate accounts one by one using rsync with SSH keys.

    This approach ensures a smooth transition from cPanel to DirectAdmin without downtime.


  • How to Migrate a Single cPanel Account to DirectAdmin


    How to Migrate a Single cPanel Account to DirectAdmin

    Switching from cPanel to DirectAdmin is becoming more common due to rising cPanel licensing costs. DirectAdmin provides a lightweight, cost-effective alternative, but migrating accounts between the two control panels requires some manual work.

    In this guide, we’ll cover how to migrate a single cPanel user account to DirectAdmin using the built-in migration tools.


    Prerequisites

    Before starting, ensure you have:

    • Root SSH access to both the cPanel server and the DirectAdmin server.
    • Enough disk space on both servers to create and transfer backups.
    • rsync or scp installed (usually preinstalled).

    Step 1: Create a cPanel Backup

    On the cPanel server, we need to generate a full account backup using cPanel’s pkgacct tool.

    Run this command (replace USERNAME with the actual cPanel username):

    /scripts/pkgacct USERNAME /home/user_backups
    

    This will create a backup file in the /home/user_backups directory.
    The backup file will look like:

    /home/user_backups/cpmove-USERNAME.tar.gz
    

    Step 2: Transfer the Backup to DirectAdmin Server

    Once the backup is ready, copy it to your DirectAdmin server. You can use rsync or scp.

    Example with rsync:

    rsync -avt /home/user_backups/cpmove-USERNAME.tar.gz root@your_directadmin_server.com:/home/admin/
    

    🔑 Make sure you replace your_directadmin_server.com with your server’s hostname or IP.

    Now the cPanel backup is on the DirectAdmin server in /home/admin/.


    Step 3: Convert the Backup for DirectAdmin

    DirectAdmin cannot restore a raw cPanel backup directly. We need to convert it first using the built-in cpanel_to_da tool.

    On the DirectAdmin server, run:

    /usr/local/directadmin/shared/cpanel_to_da/cpanel_to_da.sh /home/admin/cpmove-USERNAME.tar.gz /home/admin/converted_user_backup/
    

    This command will extract and convert the backup into a format that DirectAdmin can import.


    Step 4: Fix Ownership of the Converted Backup

    Ensure the converted files belong to the admin user, otherwise DirectAdmin won’t see them.

    Run:

    chown -R admin:admin /home/admin/converted_user_backup
    

    Step 5: Restore the Account in DirectAdmin

    Now we’re ready to restore the converted account from inside DirectAdmin.

    1. Log in to DirectAdmin as admin.
    2. Go to:
      Admin Level → Admin Backup/Transfer → Restore
    3. Set the backup path to: /home/admin/converted_user_backup
    4. Select the backup and click Restore.

    DirectAdmin will now import the account, including:

    • Website files
    • Databases
    • Emails
    • DNS settings

    Step 6: Verify the Migration

    After restoration:

    • Log in as the migrated user to check the website files.
    • Verify MySQL databases are working correctly.
    • Test email accounts.
    • Confirm DNS and domains are properly configured.

    Common Issues

    • Database errors: Sometimes MySQL versions differ between servers. Export and import databases manually if needed.
    • Email issues: Check email paths and adjust if the user had custom mail setups.
    • Disk space: Ensure your /home/admin/ directory has enough space before transferring large accounts.

    Conclusion

    Migrating a single cPanel account to DirectAdmin is straightforward with the pkgacct tool and DirectAdmin’s cpanel_to_da converter.

    The process can be summarized as:

    1. Create a cPanel backup with pkgacct.
    2. Transfer the backup to DirectAdmin.
    3. Convert it with cpanel_to_da.sh.
    4. Restore it via the DirectAdmin admin panel.

    This ensures websites, databases, and emails move smoothly during your cPanel to DirectAdmin migration.


  • Redirect cPanel Ports (2083 & 2087) to DirectAdmin Port 2222 – Migration Guide


    How to Redirect cPanel Ports (2083 & 2087) to DirectAdmin Port 2222

    Migrating from cPanel to DirectAdmin can be confusing for end-users, especially when it comes to login ports.

    • In cPanel, customers log in to their hosting account at https://domain.com:2083 and WHM at https://domain.com:2087.
    • In DirectAdmin, the login panel runs on port 2222 by default.

    This change often leads to support tickets from customers who still try to access :2083 or :2087. The good news is, you can easily redirect ports 2083 and 2087 to 2222, so old bookmarks and habits continue to work.


    Why Redirect cPanel Ports to DirectAdmin?

    • Seamless migration – Users don’t have to learn a new port right away.
    • Lower support load – Reduce “I can’t log in” tickets after migration.
    • Professional experience – Makes DirectAdmin feel like a drop-in replacement for cPanel.

    Method 1: Redirect with iptables (Recommended)

    If your Linux server uses iptables, add NAT rules to forward requests.

    Redirect port 2083 to 2222

    iptables -t nat -A PREROUTING -p tcp --dport 2083 -j REDIRECT --to-ports 2222
    

    Redirect port 2087 to 2222

    iptables -t nat -A PREROUTING -p tcp --dport 2087 -j REDIRECT --to-ports 2222
    

    Save the Rules

    These rules disappear after a reboot unless saved:

    • On CentOS / AlmaLinux / RHEL:
    service iptables save
    # or
    iptables-save > /etc/sysconfig/iptables
    
    • On Ubuntu / Debian:
    apt install iptables-persistent -y
    iptables-save > /etc/iptables/rules.v4
    

    Method 2: Redirect with firewalld (Alternative)

    If your server runs firewalld, use this instead:

    firewall-cmd --permanent --add-forward-port=port=2083:proto=tcp:toport=2222
    firewall-cmd --permanent --add-forward-port=port=2087:proto=tcp:toport=2222
    firewall-cmd --reload
    

    Testing the Redirect

    Once rules are applied:

    • https://yourdomain.com:2083 → loads DirectAdmin login.
    • https://yourdomain.com:2087 → loads DirectAdmin login.
    • https://yourdomain.com:2222 → continues to work normally.

    Final Thoughts

    When performing a cPanel to DirectAdmin migration, handling ports properly makes a huge difference for end-users. By forwarding ports 2083 and 2087 to 2222, you:

    • Improve the customer experience.
    • Prevent confusion and login errors.
    • Smoothly transition away from cPanel without disruption.

    This is a quick fix that takes only a few minutes but saves hours of support work later.