HoganHost blog

[email protected]

How to Migrate from DirectAdmin to cPanel Account Using SSH: A Step-by-Step Guide

 

Introduction

Migrating your website from DirectAdmin to cPanel can seem daunting, especially if you’re not familiar with the process. However, with the right steps, it can be done smoothly. This guide will walk you through the entire migration process using SSH, from creating a full backup in DirectAdmin to extracting files and importing the database in cPanel.

Step 1: Create a Full Backup in DirectAdmin

The first step in migrating your website is to create a full backup of your DirectAdmin account. This backup will include all your website files, databases, emails, and other important data.

  1. Log in to your DirectAdmin control panel.
  2. Navigate to the Backup/Restore page under the “Advanced Features” section.
  3. Select all the data you want to back up (typically everything).
  4. Click the “Create Backup” button to start the backup process.
  5. Wait for the backup to complete. Once done, DirectAdmin will store the backup file in your /backups directory, typically named something like backup-Sep-04-2024-1.tar.zst.

Step 2: Download the Backup File to Your cPanel Server

Once your backup is ready, the next step is to transfer it to your cPanel server. You can do this using the wget command via SSH.

  1. Log in to your cPanel server via SSH using a terminal or SSH client (like PuTTY for Windows).

    Replace username with your actual SSH username and your-cpanel-server.com with your server’s domain name or IP address.

  2. Navigate to the directory where you want to download the backup file. For example:

    cd /home/yourusername/

     

    Replace /home/yourusername/ with your actual directory path.

  3. Use the wget command to download the backup file from DirectAdmin to your cPanel server:

    wget https://hoganhost.com.ng/backup-Sep-04-2024-1.tar.zst

     

    Make sure the URL is correct, and replace it with your actual backup file URL.

Step 3: Install Zstandard (Zstd) on Your cPanel Server

The backup file you downloaded is compressed using Zstandard (.zst format), so you’ll need to install zstd on your cPanel server to decompress it.

  1. Installzstd (if it’s not already installed):
    • For CentOS/RHEL:
      sudo yum install epel-release -y
      sudo yum install zstd -y
    • For Ubuntu/Debian:
      sudo apt-get update
      sudo apt-get install zstd -y
  2. Verify the installation by checking the version:
    zstd --version


Step 4: Decompress and Extract the Backup File

With zstd installed, you can now decompress and extract the contents of your backup file.

  1. Decompress the.tar.zst file to a .tar file:

    zstd -d backup-Sep-04-2024-1.tar.zst

     

    This command will create backup-Sep-04-2024-1.tar in the same directory.

  2. Extract the .tar file to retrieve your website files, databases, and other content:
    |

    tar -xvf backup-Sep-04-2024-1.tar

     

    This command will extract all files to the current directory.

Step 5: Upload and Import Your MySQL Database

Your backup includes a MySQL database, which needs to be imported into your cPanel account.

  1. Log in to your cPanel account and create a new MySQL database and user:
    • Go to MySQL® Databases in cPanel.
    • Create a new database (e.g., my_database).
    • Create a new user (e.g., my_user) and assign it to the database with all privileges.
  2. Locate the SQL file in the extracted backup directory. It will likely be in a directory named mysql or similar.
  3. Upload the SQL file to your server using an SFTP client or the cPanel File Manager.
  4. Import the SQL file into your newly created database:
    • Via SSH:

      mysql -u my_user -p my_database < /path/to/your.sql

       

      Replace my_user, my_database, and /path/to/your.sql with your actual database name, username, and SQL file path.

    • Via phpMyAdmin:
      • Go to phpMyAdmin in cPanel.
      • Select your new database.
      • Click on the Import tab.
      • Choose the SQL file and click Go.

Step 6: Finalize Your Migration

Now that your files and database are in place, you need to finalize the migration:

  1. Update your website configuration files (like wp-config.php for WordPress) to point to the new MySQL database.
  2. Test your website to ensure everything is working correctly. This includes checking links, forms, and database connections.
  3. Update your DNS settings to point your domain to your new cPanel server, if necessary.

Conclusion

Migrating your website from DirectAdmin to cPanel using SSH may seem complex, but by following these steps, you can ensure a smooth transition. Remember to double-check your configurations and thoroughly test your site after the migration. If you encounter any issues, don’t hesitate to seek help from your hosting provider or a professional.

Check out our cheap and reliable web hosting

Leave a Comment

Your email address will not be published. Required fields are marked *