Skip to content
Follow
CMS Ubuntu Linux

Migrate Drupal to Google Cloud: A Step-by-Step Guide

Richard
Written by
Richard
Dec 29, 2021 Updated Jun 20, 2026 9 min read
How to Install Google Chrome on Ubuntu Linux
How to Install Google Chrome on Ubuntu Linux

You migrate a Drupal website to Google Cloud by performing a series of organized steps to ensure your site remains accessible. Migrating Drupal to Google Cloud involves transferring your website’s files, database, and settings to Google’s powerful cloud infrastructure, minimizing downtime for your users.

This process typically involves setting up your Google Cloud environment, often using Compute Engine instances, and then configuring your domain to point to this new server. You can achieve a seamless transition even if you’re new to cloud migrations or manage a high-traffic Drupal site.

⚡ Quick Answer

Migrate Drupal to Google Cloud by first taking inventory of your current server’s software and configurations. Then, set up a Google Cloud VM instance via the Google Cloud Console, connect via SSH, and install matching LAMP or LEMP stack components. Finally, transfer your Drupal files and database.

Taking inventory of a Linux server before migration

Before migrating your Drupal site to Google Cloud, you need to check your current Linux server to see exactly what software and settings it uses, ensuring your new Google Cloud server has everything needed for a smooth move.

Here’s what you’ll 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 see which version is installed on Ubuntu Linux.

💻Code
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 running an Nginx web server, use the commands below to see which version is installed on Ubuntu Linux.

💻Code
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 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 find out 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

Once you’ve checked your old server, the next step is setting up your new Google Cloud server where your Drupal site will live, and you can easily connect to it using SSH right from your web browser in the Google Cloud Console.

Google Cloud’s Compute Engine lets you connect to your virtual machine (VM) instance using SSH from the browser window within the Google Cloud Console

SSH from the browser supports these web browsers:

  • 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 needed. Just log in to the Google Cloud Console and go to Menu ==> Compute Engine ==> VM instances.

In the list of virtual machine instances, click SSH in the row of the instance you want to connect to.

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

Alternatively, you can open an SSH connection to an instance by clicking its name and then clicking SSH from the instance details page.

An SSH terminal window will open, connecting you to the Ubuntu Linux instance you created in the series’s second post.

You should now be able to run commands in the Ubuntu Linux environment you set up on the Google Cloud server.

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

Install LAMP or LEMP on the new server before migration

To prepare your new Google Cloud server for your Drupal site, you must install either the LAMP or LEMP software stack, making sure it’s set up just like your old server to avoid problems later.

Your goal is to ensure the new Google server has the same servers and packages as your current one. We’ve listed some helpful posts you can use to install Apache, Nginx, MySQL, MariaDB, or PHP.

You might also want to check out some other posts when installing LAMP or LEMP on Ubuntu Linux.

You can use the posts above to install the same servers and packages you have on your current server. Make sure to install specific packages on your new server by following the identical posts mentioned above.

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

Before moving your Drupal site, it’s important to make sure your new Google Cloud server’s settings match your old server’s, especially for the web server like Apache or Nginx and PHP, including directory structures and configurations.

Ensure the web server (Apache or Nginx) settings match on both the old and new servers. This includes the same directory structure and Virtual Host or Server block content.

  • 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 necessary modules from your current server.

  • PHP directory: /etc/php/

Your MySQL or MariaDB configurations should also mimic your current server. Check each file, directory, and other data to make sure your new server matches your current one before migrating.

  • MySQL / MariaDB directory: /etc/mysql/

Once you’ve completed that, you can continue with the migration process.

Back up current server data and database before migration

With your new Google Cloud server ready, the crucial next step is to back up all your Drupal website files and its database; stopping all changes first prevents new content from being added during the backup process.

You need to move your Drupal website content and database content to the new server. Back up the website content as well as the content in the database.

Before backing up your current server, stop all changes. This prevents new content from being added after the backup is complete.

To back up Drupal content, log on to your server via SSH if you have access. Once you’re on your current server’s SSH console, run the commands below to back up your Drupal content, which is usually located here: /var/www/html/.

When you run the commands below, a backup file named current-server-backup.tar will be created with your Drupal content.

🐧Bash / Shell
sudo tar -cvf current-server-backup.tar /var/www/html/

Next, back up your database content. You’ll 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:

🐧Bash / Shell
sudo mysqldump -u username –p --all-database > all_databases_backup.sql

Additionally, a file named all_databases_backup.sql should be created in the current working directory.

You should now have two files: current-server-backup.tar and all_databases_backup.sql.

Copy the current server’s content to the Google Cloud server

You should now 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 to the new server.

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.

💻Code
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; here’s how the syntax looks:

💻Code
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 them 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.

Command Prompt
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, proceed to extract them below and import the database content into your database server.

Restore the current server’s content to the Google Cloud server

After backing up your Drupal site, you’ll restore its files and database to your new Google Cloud server by using specific commands to copy the website content and import the database backup.

🐧Bash / Shell
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.

🐧Bash / Shell
sudo mysql -u root -p < all_database_backup.sql

At this point, your Google server should have the content from your current server and its database. Next, run the commands below to set up the correct permissions to match the server.

Validate that all configurations on your current server match your new Google Cloud server. Once everything is validated, restart your web server.

🐧Bash / Shell
sudo systemctl restart nginx
sudo systemctl restart apache2

If you encounter an error, be sure to resolve it.

Update your DNS and point your domain to your new Google server IP address

Before making your Drupal site live on Google Cloud, you should first test it by pointing your domain to the new server’s IP address on your local computer, and then update your public DNS records with your provider.

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:

To successfully migrate your Drupal website to Google Cloud without downtime, follow these key steps:

  • Take inventory of your current server’s configurations and versions.
  • Please set up your Google Cloud server and ensure it’s properly connected.
  • Install the necessary LAMP or LEMP stack on your new server.
  • Configure your new server to replicate your current server’s environment.
  • Back up your current website content and database.
  • Transfer your content and database to the new server.
  • Restore the backup and set the correct permissions on the new server.
  • Update your DNS records to point to the new server’s IP address.
  • Test your website thoroughly before finalizing the migration.

By following these steps, you can ensure a smooth transition with minimal disruptions to your website’s availability.

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.

📚 Related Tutorials

How to Create your Website on Google Cloud Server
Ubuntu Linux How to Create your Website on Google Cloud Server
How to Install Apache on Google Cloud Server
CMS How to Install Apache on Google Cloud Server
How to Install Nginx on Google Cloud Server
CMS How to Install Nginx on Google Cloud Server
How to Install PHP on Google Cloud Server
CMS How to Install PHP on Google Cloud Server

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

Leave a Comment

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