Manual Migration of WordPress from cPanel to a Native Ubuntu 24.04 VPS Without Plugins

Introduction

Moving your WordPress site from a cPanel environment to a native Ubuntu 24.04 VPS can significantly improve performance, security, and control. At ByteHosting, we understand the importance of a smooth, reliable migration process—especially when avoiding plugins to keep your setup lean and efficient. In this guide, we’ll walk you through a step-by-step, plugin-free method to migrate your WordPress site using rsync for files and mysqldump for your database.

Prerequisites: Backup Your Current WordPress Site

Before starting any migration, always create a complete backup of your current site. This includes your WordPress files and database. On your cPanel server, you can do this via the backup tools or manually:

  • Download your entire WordPress directory, typically located in public_html or htdocs.
  • Export your MySQL database using phpMyAdmin or command line:
mysqldump -u username -p database_name > wordpress_backup.sql

Having a backup ensures you can restore your site if anything goes wrong during migration.

Preparing Your Ubuntu VPS Environment

Set up your Ubuntu 24.04 VPS with the necessary software. Log into your server via SSH:

ssh user@your-ubuntu-vps-ip

Update your package list and install essential tools:

sudo apt update && sudo apt upgrade -y
sudo apt install -y nginx mysql-server php-fpm php-mysql rsync

Configure your web server (e.g., Nginx) and PHP settings as needed. Also, create a new MySQL database and user for your WordPress site:

sudo mysql -u root -p
CREATE DATABASE wordpress_db;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'strong_password';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Using rsync to Transfer WordPress Files

Next, transfer your WordPress files from cPanel to your new VPS. Use rsync for an efficient, reliable transfer:

rsync -avz --progress /path/to/your/wordpress/ user@your-ubuntu-vps-ip:/var/www/html/wordpress/

Replace /path/to/your/wordpress/ with your actual local path. Ensure the destination directory exists:

sudo mkdir -p /var/www/html/wordpress

Set proper permissions:

sudo chown -R www-data:www-data /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpress

Exporting and Importing the MySQL Database

Now, transfer your database. First, export it from cPanel:

mysqldump -u username -p database_name > wordpress_backup.sql

Securely copy the SQL dump to your VPS:

scp wordpress_backup.sql user@your-ubuntu-vps-ip:/tmp/

Import the database into your new MySQL server:

mysql -u wpuser -p wordpress_db < /tmp/wordpress_backup.sql

Ensure your wp-config.php file points to the new database credentials.

Configuring wp-config.php for the New Environment

On your VPS, edit wp-config.php located in your WordPress directory:

sudo nano /var/www/html/wordpress/wp-config.php

Update the database name, user, and password:

define('DB_NAME', 'wordpress_db');
define('DB_USER', 'wpuser');
define('DB_PASSWORD', 'strong_password');
define('DB_HOST', 'localhost');

Save the file and ensure permissions are correct:

sudo chown www-data:www-data /var/www/html/wordpress/wp-config.php

Testing the Migrated Site

Point your domain to the new VPS IP address or edit your local hosts file for testing. Visit your site in a browser to verify everything works correctly. Check for broken links, missing images, or database errors. Use browser developer tools and server logs to troubleshoot any issues.

Troubleshooting Common Migration Issues

  • Database connection errors: Double-check your wp-config.php credentials.
  • Missing images or CSS: Ensure file permissions are correct and paths are accurate.
  • Site URL issues: Update the siteurl and home options in the database if needed:
mysql -u wpuser -p
USE wordpress_db;
UPDATE wp_options SET option_value='http://your-new-domain.com' WHERE option_name='siteurl' OR option_name='home';
EXIT;

Conclusion

By following this manual migration process, we ensure a clean, plugin-free transfer of your WordPress site from cPanel to a native Ubuntu 24.04 VPS. This approach gives you full control over your environment, improves performance, and enhances security. At ByteHosting, we’re committed to providing reliable, affordable VPS hosting solutions—perfect for hosting your WordPress sites with confidence. If you need a cost-effective VPS to host your migrated WordPress site, explore our plans starting from just €2.00/month in Frankfurt, Germany.

Read more