Manual WordPress Migration Guide to Ubuntu Server

By Raman Kumar

Updated on May 20, 2025

In this tutorial, we'll discuss manual WordPress migration guide to ubuntu server.

Migrating a WordPress website to a new Ubuntu server can seem daunting, but with the right approach, we can ensure a seamless transition. As a reliable web hosting provider, we often assist our clients in moving their websites without downtime or data loss. In this guide, we will walk through the manual migration process, highlighting each step with clarity to help our community enjoy a smooth migration experience.

Why Manual Migration?

Manual migration gives us full control over the process, ensures that no unnecessary plugins are left behind, and helps us learn more about the structure and setup of our website. It’s an ideal approach for those who want a clean, optimized website on their new hosting environment.
Prerequisites

Prerequisites

Before starting, make sure our new Ubuntu server is ready. The following components should be installed and configured:

  • A Ubuntu 24.04 installed dedicated server or KVM VPS.
  • A root user or normal user with administrative privileges.
  • LAMP stack (Linux, Apache/Nginx, MySQL/MariaDB, PHP)
  • SFTP/SSH access to both old and new servers

Manual WordPress Migration Guide to Ubuntu Server

Now, let's dive into the step-by-step migration process.

1. Backing Up Website Files on the Old Server

All website files, including WordPress core files, themes, plugins, and media uploads, must be backed up.

Connect via SSH/SFTP and create a zipped archive:

cd /var/www/html/
tar -czvf wordpress_backup.tar.gz wordpress/

This command will compress the entire WordPress directory into a single archive.

2. Exporting the WordPress Database

WordPress stores content, settings, and user data in a MySQL database. Exporting this data is essential.

Export the database using mysqldump:

mysqldump -u db_user -p db_name > wordpress_db_backup.sql
  • Replace db_user with the actual database username.
  • Replace db_name with the actual database name.

3. Transferring Files and Database to the New Server

We recommend using scp (secure copy) or SFTP to move both the website archive and the SQL backup to the new server.

Example using scp:

scp wordpress_backup.tar.gz username@new_server_ip:/home/username/
scp wordpress_db_backup.sql username@new_server_ip:/home/username/

4. Setting Up the New Ubuntu Server

Make sure the new server has a LAMP stack ready. If not, install it:

sudo apt update
sudo apt install apache2 mysql-server php php-mysql libapache2-mod-php -y

Create a new database and user for WordPress:

sudo mysql -u root -p

Inside the MySQL shell:

CREATE DATABASE new_db_name;
CREATE USER 'new_db_user'@'localhost' IDENTIFIED BY 'strong_password';
GRANT ALL PRIVILEGES ON new_db_name.* TO 'new_db_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

5. Importing the Database

Now, import the SQL file into the new database:

mysql -u new_db_user -p new_db_name < /home/username/wordpress_db_backup.sql

6. Restoring Website Files

Extract the website archive into the new web root directory (usually /var/www/html):

sudo tar -xzvf /home/username/wordpress_backup.tar.gz -C /var/www/html/

Set the correct permissions:

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

7. Updating wp-config.php

Update the database credentials in the wp-config.php file to match the new database, username, and password:

define('DB_NAME', 'new_db_name');
define('DB_USER', 'new_db_user');
define('DB_PASSWORD', 'strong_password');
define('DB_HOST', 'localhost');

This file is located in the root of the WordPress directory.

8. Configuring Apache or Nginx

For Apache:

Create a new virtual host file:

sudo nano /etc/apache2/sites-available/wordpress.conf

Add the following (replace example.com with the actual domain):

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /var/www/html/wordpress
    <Directory /var/www/html/wordpress>
        AllowOverride All
    </Directory>
</VirtualHost>

Enable the site and rewrite module:

sudo a2ensite wordpress.conf
sudo a2enmod rewrite
sudo systemctl reload apache2

For Nginx:

Set up a similar server block and restart Nginx.

9. Testing and Final Steps

  • Update DNS records to point the domain to the new server’s IP address.
  • Visit the website and verify that everything works as expected.
  • Check for broken links, missing media, and plugin or theme functionality.
  • If the domain changed, update the site URL in the WordPress settings or via the database.

Common Issues and Troubleshooting

  • Database connection errors: Double-check the credentials in wp-config.php.
  • File permission issues: Ensure all files belong to www-data and permissions are set correctly.
  • Mixed content or URL errors: Use a plugin like “Better Search Replace” to fix old URLs in the database.

Why Manual Migration Matters

By performing a manual migration, we maintain full control over every step, ensuring a clean environment, avoiding plugin bloat, and keeping our website secure and optimized. Manual migration is a valuable skill for web administrators and offers peace of mind when moving websites between servers.

In this tutorial, we've discussed manual WordPress migration guide to ubuntu server. Migrating a WordPress site manually can seem technical at first, but following these steps will help achieve a successful transition. As a web hosting provider, we are always here to assist with migrations, optimizations, and any issues that arise. Enjoy faster, more reliable hosting with our Ubuntu-powered solutions.