Skip to content
Follow
CMS Ubuntu Linux

Seamless WordPress Migration to Google Cloud

Richard
Written by
Richard
Dec 29, 2021 Updated Sep 15, 2026 8 min read
How to Display Seconds on Ubuntu Top Menu Clock
How to Display Seconds on Ubuntu Top Menu Clock
  • 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.

    Advertisement

    Click the SSH button next to the target instance, or select the instance name and click SSH on the details page.

    establish ssh connection to vm instances
    establish ssh connection to vm instances

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

    connect to google cloud instance host
    connect to google cloud instance host

    Install LAMP or LEMP on the new server before migration

    Installing a LAMP or LEMP stack on your new server before your WordPress migration to Google Cloud ensures your site runs properly. You must set up Linux, Apache or Nginx, MySQL, and PHP to match the exact software environment your website currently uses.

    Set up a LAMP (Linux, Apache, MySQL, PHP) or LEMP (Linux, Nginx, MySQL, PHP) stack on your new instance to match your current 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.

    Advertisement

    Additional deployment guides for Ubuntu Linux are available below.

    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

    Configuring your new Google server to match your current server during a WordPress migration to Google Cloud prevents broken links and errors. You need to copy your web server settings, directory paths, and PHP configurations so both servers run the same way.

    Advertisement

    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.

    Advertisement

    Back up current server data and database before migration

    Backing up your current server data and database before a WordPress migration to Google Cloud protects you from losing files. You need to stop making changes to your live site, connect via SSH, and create an archive of all your website files and database records.

    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/.

    Advertisement

    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.sql

    An export file named all_databases_backup.sql will appear in the current working directory.

    Advertisement

    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.

    Advertisement
    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 your current server content on the Google Cloud server during a WordPress migration involves extracting your backup files and importing your database. You use SSH commands to unpack your website files into the web directory and load your database backup into MySQL.

    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

    Updating your DNS to point your domain to your new Google server IP address is the final step in your WordPress migration to Google Cloud. You log into your domain registrar, find your DNS settings, and change the A record to point to your new server's 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 rsync or SCP to 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.

    A WordPress migration to Google Cloud Platform moves your website files and database to Google servers so your pages load faster and handle high visitor traffic without crashing. Google Cloud Platform provides the online computer power and storage your site needs to run reliably.

    Setting up your server and database before you move any files prevents your site from going offline during the switch. Moving a site to Google's infrastructure involves exporting your database, copying your files over, and pointing your domain to the new server IP address.

    ⚡ Quick Answer

    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.

    Advertisement

    Taking inventory of a Linux server before migration

    Taking inventory of a Linux server before a WordPress migration to Google Cloud helps you avoid software clashes. You need to check your current web server version, database type, PHP version, and installed modules so you can match them on your new Google Cloud instance.

    Gather these key details from your current server:

    - Web server and version number - Database server and version number - PHP and related modules - Other services and their configurations
    • 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 and connecting to your Google Cloud server for your WordPress migration starts by creating a virtual machine in Compute Engine. You can then use the built-in browser SSH tool to log into your new server directly from the Google Cloud Console without extra software.

    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.

    establish ssh connection to vm instances
    establish ssh connection to vm instances

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

    connect to google cloud instance host
    connect to google cloud instance host

    Install LAMP or LEMP on the new server before migration

    Installing a LAMP or LEMP stack on your new server before your WordPress migration to Google Cloud ensures your site runs properly. You must set up Linux, Apache or Nginx, MySQL, and PHP to match the exact software environment your website currently uses.

    Set up a LAMP (Linux, Apache, MySQL, PHP) or LEMP (Linux, Nginx, MySQL, PHP) stack on your new instance to match your current 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.

    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

    Configuring your new Google server to match your current server during a WordPress migration to Google Cloud prevents broken links and errors. You need to copy your web server settings, directory paths, and PHP configurations so both servers run the same way.

    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

    Backing up your current server data and database before a WordPress migration to Google Cloud protects you from losing files. You need to stop making changes to your live site, connect via SSH, and create an archive of all your website files and database records.

    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.sql

    An 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 your current server content on the Google Cloud server during a WordPress migration involves extracting your backup files and importing your database. You use SSH commands to unpack your website files into the web directory and load your database backup into MySQL.

    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

    Updating your DNS to point your domain to your new Google server IP address is the final step in your WordPress migration to Google Cloud. You log into your domain registrar, find your DNS settings, and change the A record to point to your new server's 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 rsync or SCP to 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?

    Was this helpful?
    Richard

    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.

    Advertisement

    📚 Related Tutorials

    How to Install LAMP on Ubuntu Linux
    Ubuntu Linux How to Install LAMP on Ubuntu Linux
    How To Reset Microsoft Edge To Default Settings On Windows 11
    Browsers How To Reset Microsoft Edge To Default Settings On Windows 11
    How to Change Copy-Paste Settings in Microsoft Edge
    Browsers How to Change Copy-Paste Settings in Microsoft Edge
    How to Migrate a Website to Google Cloud Without Downtime
    CMS How to Migrate a Website to Google Cloud Without Downtime

    No comments yet — be the first to share your thoughts!

    Leave a Comment

    Your email address will not be published. Required fields are marked *