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.
You won’t need extra software or browser extensions. Log into the Google Cloud Console, then go to Menu > Compute Engine > VM instances.
Click the SSH button next to the instance you want to connect to. You can also click its name and then click SSH on the instance details page.
This opens an SSH terminal window for your Ubuntu Linux instance, where you can now run commands.

Install LAMP or LEMP on the new server before migration
Before migrating WordPress to Google Cloud, you need to install either a LAMP or LEMP stack on your new server to match your current setup.
Your goal is to ensure the new Google server has all the same servers and packages as your current server. We’ve listed some helpful posts you can use to install Apache, Nginx, MySQL, MariaDB, or PHP.
Here are some other posts you may want to use when installing LAMP or LEMP on Ubuntu Linux.
- 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
You can use the posts above to install the same servers and packages you have on your current server. Just make sure to install specific packages on your new server using the identical posts mentioned.
Once all the packages are installed, you can transfer content from your current server to the new one.
Configure your new Google server similar to your current server
Configuring your new Google Cloud server to be similar to your current one is crucial for a smooth WordPress migration, especially matching web server settings.
Make sure the web server (Apache or Nginx) settings are the same on both old and new servers. This includes the same directory structure and Virtual Host or Server block content. You can find guides on setting up these configurations in the links below:
- Apache directory: /etc/apache2/
- Nginx directory: /etc/nginx/
Your PHP configuration should also be identical to your current server’s PHP settings. Use the post above to install a specific PHP version and all the modules you have on your current server.
- PHP directory: /etc/php/
Your MySQL or MariaDB configurations should also mimic your current server. Validate each file, directory, and other data to ensure your new server is no different from your current server before migration.
- MySQL / MariaDB directory: /etc/mysql/
Once you’ve completed these checks, you can continue with the migration process.
Back up current server data and database before migration
Backing up your current server’s website files and database is a vital step before you migrate your WordPress site to Google Cloud.
First, you need to back up your WordPress website content and your database content. It’s essential to back up both the website files and the data within the database.
At this point, stop all changes on your current server before backing it up. You won’t want new changes added after the backup is complete.
To back up WordPress content, log into your server via SSH. Once in your current server’s SSH console, run the commands below to back up your WordPress content, usually located at /var/www/html/.
When you run the commands below, a backup file named current-server-backup.tar will be created containing your WordPress content.
sudo tar -cvf current-server-backup.tar /var/www/html/Next, back up your database content. Again, you need to use the root account or an account with full access to the database you wish to back up.
To back up all databases on the server, run the commands below:
sudo mysqldump -u username –p --all-database > all_databases_backup.sqlA file named all_databases_backup.sql should also be created in the current working directory.
You should now have two files: current-server-backup.tar and all_database_backup.sql.
Copy the current server’s content to the Google Cloud server
At this point, you should be ready to copy the current server’s content over to your new server. There are several ways to transfer the tar and SQL data files.
You can use the rsync command from the new server. SSH into it and use a command similar to the one shown below (remember to change the host names as needed).
While connected to your Google Cloud console, run the commands below to connect to your current server and copy over the backed-up content.
rsync -avz user@old-server.com:/home/<username>/all_database_backup.sql rsync -avz user@old-server.com:/home/<username>/current-server-backup.tar
You could also use SCP to copy your files securely. The syntax looks like this:
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 you can’t get the files using SSH, you can use the wget command to download the files to your new Google Cloud server.
You must copy the files to the current server’s web server root directory to use the commands below.
cd ~ wget http://old-web-site.com/all_database_backup.sql wget http://old-web-site.com/current-server-backup.tar
Once the files are copied to your new server, continue to extract them below and import the database content into your database server.
Restore the current server’s content to the Google Cloud server
Restoring your current server’s content to the Google Cloud server involves extracting your website files and importing your database.
tar -xvf current-server-content.tar sudo cp -rf /var/www/html/ /var/www/html/
Next, run the commands below to import the database content to your servers.
sudo mysql -u root -p < all_database_backup.sql
At this point, your Google server should have the current server and database content. Next, run the commands below to set up the correct permissions.
Validate that all configurations on your current server match your new Google Cloud server. Once everything is validated, restart your web server.
sudo systemctl restart nginx sudo systemctl restart apache2
If you encounter an error, make sure to resolve it.
Update your DNS and point your domain to your new Google server IP address
Updating your DNS to point your domain to your new Google Cloud server IP address is the final step to make your migrated WordPress site live.
Once your local test is successful, log in to your DNS provider portal and update the DNS A record to point to your new server IP address.
If everything works, you can continue fine-tuning your new server to ensure all configurations are correct.
That should do it!
Conclusion:
Migrating a WordPress website to Google Cloud can seem daunting, but you can achieve a seamless transition by following these steps. Here are the key points to remember:
- 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 will help you migrate your WordPress site with minimal downtime, ensuring a smooth experience for your 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.
Migrate your WordPress website to Google Cloud Platform (GCP) without any downtime for your visitors.
Website migration is the process of moving your existing WordPress site and its data to a new hosting provider. GCP is a powerful suite of cloud computing services that offers robust scalability and performance for your website.
You can achieve a seamless migration by carefully following a structured approach, beginning with setting up your GCP infrastructure. This involves configuring virtual machines, databases, and networking components, often leveraging services like Compute Engine and Cloud SQL.
This tutorial will walk you through the essential steps, including the critical DNS record updates, to ensure your WordPress site is live and fully functional on Google Cloud. We’ll focus on making this complex process straightforward for you.
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
Taking inventory of your current Linux server is the first step before you migrate your WordPress site to Google Cloud, ensuring your new setup matches your old one.
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
If you’re running an Apache web server, use the commands below to determine its version on Ubuntu Linux.
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
If you’re running an Nginx web server, use the commands below to determine its version on Ubuntu Linux.
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 you’re running MySQL or MariaDB, the post below shows you how to determine which version runs 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 your Google Cloud server involves creating a virtual machine, called a Compute Engine instance, which will host your WordPress site.
Google Cloud servers, specifically Compute Engine, let you connect to your virtual machine (VM) instance directly from your browser via SSH within the Google Cloud Console.
SSH from the browser supports the following:
- 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.
You won’t need extra software or browser extensions. Log into the Google Cloud Console, then go to Menu > Compute Engine > VM instances.
Click the SSH button next to the instance you want to connect to. You can also click its name and then click SSH on the instance details page.
This opens an SSH terminal window for your Ubuntu Linux instance, where you can now run commands.

Install LAMP or LEMP on the new server before migration
Before migrating WordPress to Google Cloud, you need to install either a LAMP or LEMP stack on your new server to match your current setup.
Your goal is to ensure the new Google server has all the same servers and packages as your current server. We’ve listed some helpful posts you can use to install Apache, Nginx, MySQL, MariaDB, or PHP.
Here are some other posts you may want to use when installing LAMP or LEMP on Ubuntu Linux.
- 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
You can use the posts above to install the same servers and packages you have on your current server. Just make sure to install specific packages on your new server using the identical posts mentioned.
Once all the packages are installed, you can transfer content from your current server to the new one.
Configure your new Google server similar to your current server
Configuring your new Google Cloud server to be similar to your current one is crucial for a smooth WordPress migration, especially matching web server settings.
Make sure the web server (Apache or Nginx) settings are the same on both old and new servers. This includes the same directory structure and Virtual Host or Server block content. You can find guides on setting up these configurations in the links below:
- Apache directory: /etc/apache2/
- Nginx directory: /etc/nginx/
Your PHP configuration should also be identical to your current server’s PHP settings. Use the post above to install a specific PHP version and all the modules you have on your current server.
- PHP directory: /etc/php/
Your MySQL or MariaDB configurations should also mimic your current server. Validate each file, directory, and other data to ensure your new server is no different from your current server before migration.
- MySQL / MariaDB directory: /etc/mysql/
Once you’ve completed these checks, you can continue with the migration process.
Back up current server data and database before migration
Backing up your current server’s website files and database is a vital step before you migrate your WordPress site to Google Cloud.
First, you need to back up your WordPress website content and your database content. It’s essential to back up both the website files and the data within the database.
At this point, stop all changes on your current server before backing it up. You won’t want new changes added after the backup is complete.
To back up WordPress content, log into your server via SSH. Once in your current server’s SSH console, run the commands below to back up your WordPress content, usually located at /var/www/html/.
When you run the commands below, a backup file named current-server-backup.tar will be created containing your WordPress content.
sudo tar -cvf current-server-backup.tar /var/www/html/Next, back up your database content. Again, you need to use the root account or an account with full access to the database you wish to back up.
To back up all databases on the server, run the commands below:
sudo mysqldump -u username –p --all-database > all_databases_backup.sqlA file named all_databases_backup.sql should also be created in the current working directory.
You should now have two files: current-server-backup.tar and all_database_backup.sql.
Copy the current server’s content to the Google Cloud server
At this point, you should be ready to copy the current server’s content over to your new server. There are several ways to transfer the tar and SQL data files.
You can use the rsync command from the new server. SSH into it and use a command similar to the one shown below (remember to change the host names as needed).
While connected to your Google Cloud console, run the commands below to connect to your current server and copy over the backed-up content.
rsync -avz user@old-server.com:/home/<username>/all_database_backup.sql rsync -avz user@old-server.com:/home/<username>/current-server-backup.tar
You could also use SCP to copy your files securely. The syntax looks like this:
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 you can’t get the files using SSH, you can use the wget command to download the files to your new Google Cloud server.
You must copy the files to the current server’s web server root directory to use the commands below.
cd ~ wget http://old-web-site.com/all_database_backup.sql wget http://old-web-site.com/current-server-backup.tar
Once the files are copied to your new server, continue to extract them below and import the database content into your database server.
Restore the current server’s content to the Google Cloud server
Restoring your current server’s content to the Google Cloud server involves extracting your website files and importing your database.
tar -xvf current-server-content.tar sudo cp -rf /var/www/html/ /var/www/html/
Next, run the commands below to import the database content to your servers.
sudo mysql -u root -p < all_database_backup.sql
At this point, your Google server should have the current server and database content. Next, run the commands below to set up the correct permissions.
Validate that all configurations on your current server match your new Google Cloud server. Once everything is validated, restart your web server.
sudo systemctl restart nginx sudo systemctl restart apache2
If you encounter an error, make sure to resolve it.
Update your DNS and point your domain to your new Google server IP address
Updating your DNS to point your domain to your new Google Cloud server IP address is the final step to make your migrated WordPress site live.
Once your local test is successful, log in to your DNS provider portal and update the DNS A record to point to your new server IP address.
If everything works, you can continue fine-tuning your new server to ensure all configurations are correct.
That should do it!
Conclusion:
Migrating a WordPress website to Google Cloud can seem daunting, but you can achieve a seamless transition by following these steps. Here are the key points to remember:
- 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 will help you migrate your WordPress site with minimal downtime, ensuring a smooth experience for your 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!