Manual Migration of WordPress from cPanel to Ubuntu 24.04 VPS Using Rsync and mysqldump
Introduction
Moving your WordPress site from a cPanel hosting environment to a dedicated Ubuntu 24.04 VPS can significantly improve performance, security, and control. At ByteHosting, we understand that a manual migration might seem daunting, especially if you're new to server management. That’s why we’ve prepared this step-by-step tutorial to guide you through the process using native tools like rsync and mysqldump. Our goal is to make your migration smooth, reliable, and cost-effective.
Prerequisites
Before starting, ensure you have:
- Access to your current cPanel hosting account with permissions to download files and databases.
- A fresh Ubuntu 24.04 VPS from ByteHosting, with SSH access configured.
- Basic familiarity with command-line operations.
- Root or sudo privileges on your new VPS.
Backing Up WordPress Files with rsync
The first step is to securely copy all your WordPress files from cPanel to your VPS. We recommend rsync because it efficiently transfers only changed parts of files, saving time and bandwidth.
Step-by-step:
- Log in to your cPanel account and locate the File Manager or connect via FTP to identify your WordPress directory, typically
public_html. - Open your terminal or SSH client and run the following command:
- Replace
user@your-cpanel-serverwith your cPanel username and server IP or domain. Also, specify the local directory where you want to store the backup. - Once completed, your WordPress files are safely stored locally, ready to be transferred to your new server.
rsync -avz --progress -e ssh user@your-cpanel-server:/home/youruser/public_html/ /path/to/local/backup/Exporting the MySQL Database with mysqldump
Next, you need to export your WordPress database. This contains all your posts, pages, and settings.
Steps:
- In cPanel, access phpMyAdmin or use SSH to connect to your database server.
- Run the following command to export your database:
- Replace
dbuseranddbnamewith your database username and name. You will be prompted for your database password. - This creates a SQL dump file named
wordpress_backup.sqlin your current directory.
mysqldump -u dbuser -p dbname > wordpress_backup.sqlTransferring Files and Database to the New VPS
Now, transfer both your WordPress files and database dump to your Ubuntu VPS.
Commands:
rsync -avz --progress -e ssh /path/to/local/backup/ user@your-vps-ip:/var/www/yourdomain.com/
scp wordpress_backup.sql user@your-vps-ip:/tmp/Ensure the target directory on your VPS (/var/www/yourdomain.com/) exists and has proper permissions.
Importing the Database and Restoring Files
Database Import:
ssh user@your-vps-ipmysql -u dbuser -p dbname < /tmp/wordpress_backup.sqlReplace dbuser, dbname with your database credentials. This restores your database on the new server.
File Restoration:
Ensure your web server (e.g., Apache or Nginx) points to the WordPress directory. Set correct permissions:
sudo chown -R www-data:www-data /var/www/yourdomain.com/
sudo chmod -R 755 /var/www/yourdomain.com/Configuring WordPress on the New Server
Update your wp-config.php file with the new database credentials. Also, check your siteurl and home options in the database if your domain has changed.
Verifying the Migration and Troubleshooting
Finally, visit your domain to verify the site loads correctly. Clear your browser cache if needed. If you encounter issues:
- Check your web server logs for errors.
- Ensure database credentials are correct in
wp-config.php. - Verify file permissions and ownership.
- Confirm DNS records point to your new VPS IP.
Conclusion
Manually migrating WordPress from cPanel to an Ubuntu 24.04 VPS using native tools like rsync and mysqldump is a reliable and cost-effective approach. While it requires some command-line familiarity, following this step-by-step guide ensures a smooth transition. At ByteHosting, we’re committed to providing affordable, high-performance VPS hosting in Frankfurt am Main, supporting your migration journey every step of the way. If you need a new VPS to host your WordPress site, explore our plans and experience instant deployment, excellent uptime, and dedicated support.