How to Migrate WordPress from cPanel to a Native Ubuntu 24.04 VPS Without Plugins
Introduction
Moving a WordPress site from cPanel hosting to a dedicated VPS can seem daunting, especially if you want to avoid using plugins. At ByteHosting, we understand the importance of a smooth, secure migration process that maintains your site's integrity and performance. In this guide, we’ll walk you through how to migrate WordPress from cPanel to a native Ubuntu 24.04 VPS without relying on plugins, focusing on manual data transfer, database migration, and configuration.
Prerequisites
- An existing cPanel hosting account with your WordPress site
- A fresh Ubuntu 24.04 VPS from ByteHosting or another provider
- Domain name configured to point to your new server’s IP address
- Basic knowledge of Linux command line and MySQL
Exporting WordPress Files and Database from cPanel
1. Download WordPress Files
First, access your cPanel file manager or connect via FTP. Locate your WordPress installation directory, typically in public_html. Compress the entire folder into a ZIP archive for easier transfer.
zip -r wordpress-files.zip /path/to/your/wordpressDownload the ZIP file to your local machine.
2. Export the Database
In cPanel, open phpMyAdmin. Select your WordPress database, then click on the Export tab. Choose the Quick export method and SQL format, then click Go.
This will download a .sql file containing your database data.
Setting Up Your Ubuntu 24.04 VPS
1. Install LAMP Stack
Connect to your server via SSH:
ssh root@your_server_ipUpdate your package list and install Apache, MySQL, and PHP:
apt update
apt install apache2 mysql-server php libapache2-mod-php php-mysql -ySecure your MySQL installation:
mysql_secure_installationFollow the prompts to set a root password and secure your database server.
Importing Data to Your New Server
1. Upload Files and Database
Transfer your ZIP archive and SQL dump to the server, using SCP or SFTP:
scp wordpress-files.zip root@your_server_ip:/var/www/htmlscp database.sql root@your_server_ip:/tmpUnzip your WordPress files into the web root:
unzip /var/www/html/wordpress-files.zip -d /var/www/html/yourdomainReplace /var/www/html/yourdomain with your actual domain directory.
2. Create a New Database and User
mysql -u root -pInside MySQL shell, run:
CREATE DATABASE wordpress_db DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;3. Import the Database
mysql -u wpuser -p wordpress_db < /tmp/database.sqlConfiguring wp-config.php
Navigate to your WordPress directory and edit wp-config.php:
nano /var/www/html/yourdomain/wp-config.phpUpdate the database connection details:
define('DB_NAME', 'wordpress_db');
define('DB_USER', 'wpuser');
define('DB_PASSWORD', 'your_password');
define('DB_HOST', 'localhost');Save and exit.
Updating DNS and Testing
Point your domain’s DNS A record to your new server’s IP address. It may take some time for DNS propagation.
Once propagated, visit your domain in a browser. Your WordPress site should load from the new server. Check all pages and functionalities to ensure everything migrated correctly.
Troubleshooting Common Migration Issues
- 404 errors or missing images: Check your
wp-config.phpand permalinks settings. - Database connection errors: Verify your
wp-config.phpdatabase credentials. - Site URL issues: Update the
siteurlandhomeoptions in the database if needed.
Conclusion
Manually migrating WordPress from cPanel to a native Ubuntu 24.04 VPS without plugins is entirely feasible with some basic Linux and database management skills. At ByteHosting, we provide reliable, affordable VPS hosting that can serve as a robust platform for your WordPress site. By following this step-by-step guide, you can ensure a smooth transition, maintain control over your data, and optimize your site’s performance on your new server. If you need a cost-effective VPS to host your WordPress site, explore our plans and experience enterprise-grade infrastructure with instant deployment and excellent support.