Seamless WordPress Migration to Google Cloud
- The latest version of Google Chrome
- Firefox
- Microsoft Edge
- Microsoft Internet Explorer 11 and later
- Safari 8 and later. Note that Safari is not supported in private browser mode.
- All Linux VM images are natively available in Google Cloud.
No extra software or browser extensions are required. Log into the Google Cloud Console, then go to Menu Compute Engine VM instances.
Click the SSH button next to the target instance, or select the instance name and click SSH on the details page.

This action opens an SSH terminal window for the Ubuntu Linux instance, ready for command execution.

Install LAMP or LEMP on the new server before migration
Before migrating the WordPress site to Google Cloud, deploy a LAMP (Linux, Apache, MySQL, PHP) or LEMP (Linux, Nginx, MySQL, PHP) stack on the new instance to match the required software environment.
Deploy a LAMP (Linux, Apache, MySQL, PHP) or LEMP (Linux, Nginx, MySQL, PHP) stack on the new instance to match the required software environment. Replicating the existing software stack ensures parity with the source server. Review the linked installation guides for Apache, Nginx, MySQL, MariaDB, and PHP.
Additional deployment guides for Ubuntu Linux are available below.
- How to install Apache on a Google Cloud server (alternative to Nginx)
- How to install Nginx on a Google Cloud server (alternative to Apache)
- How to install PHP on a Google Cloud server
- How to install MySQL or MariaDB database server
Use these resources to match packages across servers. Install specific package versions corresponding to the source environment.
Once all packages are installed, transfer content from the source server to the destination.
Configure your new Google server similar to your current server
Successful migration requires configuring the destination server to mirror the source environment.
Web server configurations, including directory structures and Virtual Host or Server blocks, must match between servers. Apache and Nginx configuration guides appear in the links below.
- Apache directory: /etc/apache2/
- Nginx directory: /etc/nginx/
PHP configurations must match the source server settings. Use the referenced guide to install the matching PHP version and required modules.
- PHP directory: /etc/php/
MySQL or MariaDB configurations should also mimic the source server. Validate each file, directory, and other data to ensure the destination server matches the source before proceeding.
- MySQL / MariaDB directory: /etc/mysql/
After completing these validation checks, continue with the migration process.
Back up current server data and database before migration
Creating a complete backup of all website files and databases is necessary before initiating the migration.
Backing up application files and database records protects against data loss during transit.
Halt all site modifications before creating the backup to prevent data drift.
Access the source server via SSH to generate the backup. Run the following commands to archive the WordPress content directory, typically found at /var/www/html/.
Executing these commands generates an archive named current-server-backup.tar containing the WordPress files.
sudo tar -cvf current-server-backup.tar /var/www/html/Next, back up the database. Administrative or root database privileges are required for this step.
Run the commands below to export all databases:
sudo mysqldump -u username –p --all-database > all_databases_backup.sqlAn export file named all_databases_backup.sql will appear in the current working directory.
Two archives should now exist: current-server-backup.tar and all_database_backup.sql.
Copy the current server's content to the Google Cloud server
File archives are now ready to move. Transfer the archives using the rsync utility or Secure Copy Protocol (SCP).
Execute the rsync command from the new server. SSH into the destination instance and run a transfer command, substituting the correct hostnames.
Connected to the Google Cloud console, execute the retrieval commands to pull the backup archives from the source server.
rsync -avz user@old-server.com:/home/<username>/all_database_backup.sql rsync -avz user@old-server.com:/home/<username>/current-server-backup.tar
Alternatively, copy files securely using SCP with the following syntax:
scp user@old-server.com:/home/<username>/all_database_backup.sql /home/username/ scp user@old-server.com:/home/<username>/current-server-backup.tar /home/username/
If SSH transfer methods fail, download the files using the wget command.
Files must reside in the web server root directory of the destination server to use the following commands.
cd ~ wget http://old-web-site.com/all_database_backup.sql wget http://old-web-site.com/current-server-backup.tar
Once file transfer completes, extract the archives and import the database dump into the database server.
Restore the current server's content to the Google Cloud server
Restoring files and importing the database to the new Google Cloud server follows the backup phase.
tar -xvf current-server-content.tar sudo cp -rf /var/www/html/ /var/www/html/
Next, execute the following commands to import the database records.
sudo mysql -u root -p < all_database_backup.sql
With site files and database content in place, assign the correct file permissions using the commands below.
Verify that all configurations on the destination server match the source environment. Restart the web server once verification is complete.
sudo systemctl restart nginx sudo systemctl restart apache2
Resolve any errors encountered during startup.
Update your DNS and point your domain to your new Google server IP address
The final migration step involves updating domain DNS records to point to the new server IP address.
After confirming local functionality, log into the DNS provider portal and update the DNS A record to target the new server IP address.
Continue fine-tuning server configurations as needed.
That should do it!
Conclusion:
Migrating a WordPress website to Google Cloud requires following specific steps. Achieving a smooth transition means remembering key actions.
- Take Inventory: Document your existing server's environment before starting the migration.
- Set Up Your Google Cloud Server: Ensure your new configuration matches your current setup.
- Install Required Software: Ensure all necessary software (LAMP/LEMP) is installed on the new server.
- Back-Up Data: Always back up your website files and database before making any changes.
- Transfer Content: Use secure methods such as
rsyncorSCPto transfer your files to the new server. - Restore Data: Extract and import your database and website content to your Google Cloud server.
- Test Before Going Live: Conduct local tests to ensure everything functions as expected.
- Update DNS Records: Point your domain to the new server's IP address once everything is verified to be working.
Following these steps helps migrate a WordPress site with minimal downtime, ensuring a smooth experience for visitors.
Can I run WordPress on Google Cloud?
Google Cloud's hosting services give your WordPress site improved performance, virtually limitless scalability, stronger security, greater control, and more flexibility. Once your free trial ends, you can continue to host your website starting at USD 13.17/month with WordPress on Google Cloud.
Moving a WordPress site to Google Cloud Platform transfers your website files and database to Google servers so your site loads faster and handles high visitor traffic without crashing.
Google Cloud Platform provides the online computer power and storage your site needs to run smoothly. Setting up the server and database before you move any files prevents your site from going offline during the switch.
Prepare your existing server by documenting its configuration, then set up a new virtual machine instance on Google Cloud. Install a LAMP or LEMP stack on the new server to match your current setup before transferring your WordPress files.
Taking inventory of a Linux server before migration
Documenting the existing environment prevents compatibility issues later. Gather these key details from the current server:
Here's what you need to gather from your current server:
- Web server and version number
- Database server and version number
- PHP and related modules
- Other servers and services and how they're configured
To find the Apache web server version on Ubuntu Linux, run specific commands. These commands output the exact Apache version number, such as Apache/2.4.41, which is crucial for compatibility checks and security updates.
apache2 -v
For more detailed version checks and steps to install a specific Apache version, read the post below:
How to check and install specific Apache versions on Ubuntu Linux
Nginx web server version checking on Ubuntu Linux requires specific commands. To find the Nginx version, users on Ubuntu Linux can run the command `nginx -v`. This command directly displays the installed Nginx software version, for example, `nginx version: nginx/1.18.0`.
nginx -v
For more detailed version checks and steps to install a specific Nginx version, read the post below:
How to check and install specific Nginx versions on Ubuntu Linux
To check your PHP version and learn how to install a specific one on Ubuntu Linux, read the post below:
How to check and install specific PHP versions on Ubuntu Linux
Whether running MySQL or MariaDB, the post below outlines methods to identify the active version on Ubuntu Linux.
How to find what version of MySQL or MariaDB runs on Ubuntu Linux
How to set up and connect to your Google Cloud server
Setting up the Google Cloud server involves provisioning a virtual machine instance through Compute Engine and establishing a connection.
Compute Engine allows browser-based SSH access to virtual machine (VM) instances directly inside the Google Cloud Console.
Browser SSH supports Google Chrome (latest version), Firefox, Microsoft Edge, Internet Explorer 11 and later, and Safari 8 and later. Note that Safari does not support private browser mode.
- Web browsers
- The latest version of Google Chrome
- Firefox
- Microsoft Edge
- Microsoft Internet Explorer 11 and later
- Safari 8 and later. Note that Safari is not supported in private browser mode.
- Virtual machine configurations
- All Linux VM images are natively available in Google Cloud.
No extra software or browser extensions are required. Log into the Google Cloud Console, then go to Menu Compute Engine VM instances.
Click the SSH button next to the target instance, or select the instance name and click SSH on the details page.

This action opens an SSH terminal window for the Ubuntu Linux instance, ready for command execution.

Install LAMP or LEMP on the new server before migration
Before migrating the WordPress site to Google Cloud, deploy a LAMP (Linux, Apache, MySQL, PHP) or LEMP (Linux, Nginx, MySQL, PHP) stack on the new instance to match the required software environment.
Deploy a LAMP (Linux, Apache, MySQL, PHP) or LEMP (Linux, Nginx, MySQL, PHP) stack on the new instance to match the required software environment. Replicating the existing software stack ensures parity with the source server. Review the linked installation guides for Apache, Nginx, MySQL, MariaDB, and PHP.
Additional deployment guides for Ubuntu Linux are available below.
- How to install Apache on a Google Cloud server (alternative to Nginx)
- How to install Nginx on a Google Cloud server (alternative to Apache)
- How to install PHP on a Google Cloud server
- How to install MySQL or MariaDB database server
Use these resources to match packages across servers. Install specific package versions corresponding to the source environment.
Once all packages are installed, transfer content from the source server to the destination.
Configure your new Google server similar to your current server
Successful migration requires configuring the destination server to mirror the source environment.
Web server configurations, including directory structures and Virtual Host or Server blocks, must match between servers. Apache and Nginx configuration guides appear in the links below.
- Apache directory: /etc/apache2/
- Nginx directory: /etc/nginx/
PHP configurations must match the source server settings. Use the referenced guide to install the matching PHP version and required modules.
- PHP directory: /etc/php/
MySQL or MariaDB configurations should also mimic the source server. Validate each file, directory, and other data to ensure the destination server matches the source before proceeding.
- MySQL / MariaDB directory: /etc/mysql/
After completing these validation checks, continue with the migration process.
Back up current server data and database before migration
Creating a complete backup of all website files and databases is necessary before initiating the migration.
Backing up application files and database records protects against data loss during transit.
Halt all site modifications before creating the backup to prevent data drift.
Access the source server via SSH to generate the backup. Run the following commands to archive the WordPress content directory, typically found at /var/www/html/.
Executing these commands generates an archive named current-server-backup.tar containing the WordPress files.
sudo tar -cvf current-server-backup.tar /var/www/html/Next, back up the database. Administrative or root database privileges are required for this step.
Run the commands below to export all databases:
sudo mysqldump -u username –p --all-database > all_databases_backup.sqlAn export file named all_databases_backup.sql will appear in the current working directory.
Two archives should now exist: current-server-backup.tar and all_database_backup.sql.
Copy the current server's content to the Google Cloud server
File archives are now ready to move. Transfer the archives using the rsync utility or Secure Copy Protocol (SCP).
Execute the rsync command from the new server. SSH into the destination instance and run a transfer command, substituting the correct hostnames.
Connected to the Google Cloud console, execute the retrieval commands to pull the backup archives from the source server.
rsync -avz user@old-server.com:/home/<username>/all_database_backup.sql rsync -avz user@old-server.com:/home/<username>/current-server-backup.tar
Alternatively, copy files securely using SCP with the following syntax:
scp user@old-server.com:/home/<username>/all_database_backup.sql /home/username/ scp user@old-server.com:/home/<username>/current-server-backup.tar /home/username/
If SSH transfer methods fail, download the files using the wget command.
Files must reside in the web server root directory of the destination server to use the following commands.
cd ~ wget http://old-web-site.com/all_database_backup.sql wget http://old-web-site.com/current-server-backup.tar
Once file transfer completes, extract the archives and import the database dump into the database server.
Restore the current server's content to the Google Cloud server
Restoring files and importing the database to the new Google Cloud server follows the backup phase.
tar -xvf current-server-content.tar sudo cp -rf /var/www/html/ /var/www/html/
Next, execute the following commands to import the database records.
sudo mysql -u root -p < all_database_backup.sql
With site files and database content in place, assign the correct file permissions using the commands below.
Verify that all configurations on the destination server match the source environment. Restart the web server once verification is complete.
sudo systemctl restart nginx sudo systemctl restart apache2
Resolve any errors encountered during startup.
Update your DNS and point your domain to your new Google server IP address
The final migration step involves updating domain DNS records to point to the new server IP address.
After confirming local functionality, log into the DNS provider portal and update the DNS A record to target the new server IP address.
Continue fine-tuning server configurations as needed.
That should do it!
Conclusion:
Migrating a WordPress website to Google Cloud requires following specific steps. Achieving a smooth transition means remembering key actions.
- Take Inventory: Document your existing server's environment before starting the migration.
- Set Up Your Google Cloud Server: Ensure your new configuration matches your current setup.
- Install Required Software: Ensure all necessary software (LAMP/LEMP) is installed on the new server.
- Back-Up Data: Always back up your website files and database before making any changes.
- Transfer Content: Use secure methods such as
rsyncorSCPto transfer your files to the new server. - Restore Data: Extract and import your database and website content to your Google Cloud server.
- Test Before Going Live: Conduct local tests to ensure everything functions as expected.
- Update DNS Records: Point your domain to the new server's IP address once everything is verified to be working.
Following these steps helps migrate a WordPress site with minimal downtime, ensuring a smooth experience for visitors.
Can I run WordPress on Google Cloud?
Google Cloud's hosting services give your WordPress site improved performance, virtually limitless scalability, stronger security, greater control, and more flexibility. Once your free trial ends, you can continue to host your website starting at USD 13.17/month with WordPress on Google Cloud.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.
No comments yet — be the first to share your thoughts!