How to Install Magento on Google Cloud (Managed + Manual Methods)
When running a successful e-commerce business, your hosting choice can make all the difference.
Whether you’re navigating through shared hosting, dedicated servers, or the cloud, the real MVP often turns out to be cloud hosting.
One of the top cloud providers is Google Cloud Engine (GCE). It steals the spotlight, especially when dealing with Magento and other PHP-based applications.
Boasting an impressive 99.99% guaranteed uptime, no wonder Magento Ecommerce store owners and developers prefer GCE.
In this blog, we’ll cover both the managed (Cloudways) and manual methods of installing Magento Google Cloud, allowing you to run a successful ecommerce business without breaking a sweat.
Why Should You Host Your Magento Store on Google Cloud Engine?
While numerous advantages exist for Magento on Google Cloud Engine, below are some key reasons to consider using Magento Google Cloud Hosting:
One of the most popular reasons for using Magento Cloud hosting is the uptime it provides. The GCE servers rarely go down, giving you a 99.99% uptime without hiccups.
Speed is one of the basic requirements for successful Magento-powered web stores. Magento stores hosted on GCE cloud servers are extremely fast and are fully optimized for peak performance. Here are some of the network performance statistics reported by ServerDensity.
The GCE is the backbone of various services and products offered by Google. By hosting your Magento on Google Cloud, you get a very reliable and modern infrastructure for your ecommerce store.
Google Cloud Engine is easy to use, with an interface similar to the well-known Google website. This makes online transactions smooth for customers. The simplicity positively affects business performance, drawing customers to websites that are easy to navigate.
With GCE, you can easily handle unanticipated traffic hikes easily. When you feel that the server resources are getting low, you can quickly scale your GCE server by using the scaling features available on the cloud platform. It’s a 1-click operation, and you don’t have to worry about the IP addresses as they will remain intact.
Now that I have discussed the benefits of hosting Magento on Google Cloud, let’s discuss the challenges.
Unleash Superior Performance with Cloudways Managed Google Hosting
Benefit from 24/7/365 support, optimized stack, robust security, free SSL, and more. Elevate your online presence—make the switch to Cloudways today!
Why Choose Cloudways for Hosting Magento on GCE?
Cloudways saves you precious time by installing Magento with a single click. In addition, the platform comes with:
- Three IaaS providers (DigitalOcean, GCE, and AWS)
- Multiple Datacenters locations (43+)
- Optimized Server Stack for Magento 2.x stores
- 24/7/365 Security
- FREE SSL Certificates powered by Let’s Encrypt
- SSH/SFTP Access
- Cloudways Magento Full Page Cache for Magento 1.x
- Varnish Cache for Magento 2.x
- Access to CLI within the Platform
- Push code via GIT
- Remote SQL connections
- Unlimited Applications on a server
- Unlimited Staging Domains
- Server Transfer
- Server and Application Cloning
- Application Staging Environment
- Cron Job Manager
- Server and App Resource Monitoring
- Backups Scheduling
- Pay-as-you-Go billing
- Team Collaboration Features
- Free Migration
- Add-ons for Email, DNS, etc.
Optimize Magento Speed Like a Pro
Subscribe now and get a free eBook to your inbox.
Your eBook is on its Way to Your Inbox.
Launch Magento on Google Cloud Engine (GCE) With Cloudways [Easy Method]
You can launch your GCE server with Cloudways in just a few clicks without any complications. You’ll get to enjoy a user-friendly UI design, a feature-rich console, and numerous other built-in features.
Follow the steps below to get started with your Magento Store on Google Cloud.
- Select Magento from the drop-down menu, and give your server, application, and project a name.
- Select GCE from the available cloud infrastructure options.
- Choose your server size based on your store traffic. Next, select Bandwidth and storage size for your database and application files.
Select the server location nearest to your audience. Once done, hit the Launch Now button to deploy the Magento on Google Cloud.
Magento 2 Installation on Google Cloud via Composer [Manual Method]
In contrast to the Cloudways method we discussed earlier, the manual approach is considerably more technical, involving the execution of numerous commands. Nevertheless, the steps below outline the manual process for setting up Magento on Google Cloud hosting.
Go to Google Cloud Platform and Set up an Account
- Start by going to Google Compute Engine and choosing VM instances. Your Google Cloud hosting can be found in the VM instances section.
- To initiate the setup of a new Magento store, click the “Create” button. If you already have an existing store, you can opt to “import” it using the migration service. If you are uncertain, access Google Cloud’s assistance by clicking on the “Take the quickstart” button.
For the purpose of this article, I will start from scratch.
Create a New Google Cloud Instance
To create a new instance, specify the following details:
- Instance Name: Provide a name for the instance.
- Region & Zone: Choose the region and zone where you intend to host your Magento store. Opt for a location close to your target audience to minimize latency and enhance server response time.
- Machine Configuration/Resources: Define the necessary resources for hosting and running your Magento store successfully. Specify the number of CPUs, RAM, storage, and other technical details. In my case, I’ve selected a Linux environment and opted for Ubuntu OS for the installation. Feel free to choose any other Linux distribution according to your preferences.
- API Access and Firewall: Set up API access and configure the firewall settings for your application.
- After specifying all the details for creating the instance, click the “Create” button.
Install Magento Pre-Requisite Tools on the Google Cloud Server
- You will need to execute all the commands mentioned in the installation guide in the SSH terminal to install the required Magento setup tools on Google Cloud hosting:
- To display all directories in the server on the SSH terminal, use the following command:
- This command will generate a list of directories in the Google Cloud server.
Step 1: Log in as a Root User
To begin, log in as the root user using the following command:
Upon executing this command, you will be directed to the home/ubuntu directory, confirming your login as the root user.
Step 2: Update Your Server With the Latest Tools
In the next step, update your server with the latest tools by using the following command:
This command will refresh and update the list of tools on your server.
Step 3: Setting up Lamp (Linux, Apache, Mysql/MariaDB, PHP) Setup for Magento
Proceed with setting up the LAMP (Linux, Apache, MySQL/MariaDB, PHP) environment for Magento using the following command:
sudo apt-get install apache2 php libapache2-mod-php mysql-server php-mysql
This command will install all the necessary files for PHP, MySQL, and Apache, ensuring that your Magento environment has the required components.
Note: The entire setup covered here is for Magento version dev-2.3-develop. For the latest version of Magento (2.4.6), you can read the system requirements here.
To finalize the LAMP setup, run the following command:
apt-get install php7.2-gd
(Choose the PHP version based on your current Magento version requirements)
apt-get install php7.2-mcrypt
(Choose the PHP version based on your current Magento version requirements)
sudo a2enmod rewrite
systemctl restart apache2
Navigate to the Apache directory and execute the following commands to configure your Google Cloud hosting:
Then, open the apache2.conf file with the nano text editor:
sudo nano apache2.conf
Press Ctrl + W to initiate a search, and look for the term “Indexes” in the configuration file.
Replace ‘None’ with ‘all’ (as shown in the image below):
After making the necessary changes in the apache2.conf file, press Ctrl + X, then press ‘Y’ to confirm the changes, and hit ‘Enter’ to save the file.
Next, restart the Apache services with the following command:
systemctl restart apache2.service
Once the services are restarted, navigate to the public root directory and clone Magento 2 from GitHub:
You are now in the directory where you can clone Magento 2.
Execute the following commands to clone the Magento 2 repository from GitHub and navigate into the cloned directory:
git clone https://github.com/Magento/Magento2.git cd Magento2
These commands will download the Magento 2 source code from the specified GitHub repository and change your current directory to the Magento2 directory.
To install the necessary dependencies using Composer, run the following command:
If you encounter an error similar to the one shown in the image below, please provide details about the error message so that I can assist you in resolving it.
In my case, I tried running the following command:
apt-get install php7.2-bcmath
This command installs the php7.2-bcmath package, which might address your encountered error.
I encountered the same error again while installing Composer using the command composer install.
If you’re still facing difficulties with installing Composer, as shown in the provided screengrab, try resolving the issue by running the following command:
sudo apt-get install php-soap
This command installs the php-soap package, which may address the obstacle encountered during the Composer installation.
After successfully running the sudo apt-get install php-soap command, I again executed the composer install command. This time, I was able to install Composer.
To finalize the Magento setup and ensure the installation of required files, adjust the folder permissions using the following commands:
chmod -R 755 /var/www/html/Magento2/ chmod -R 777 /var/www/html/Magento2/var/ chmod -R 777 /var/www/html/Magento2/pub/ chmod -R 777 /var/www/html/Magento2/app/etc chmod -R 777 /var/www/html/Magento2/generated
These commands set the necessary permissions for the specified directories. Once done, restart the Apache service to apply the changes:
sudo service apache2 restart
This restart is an important step because otherwise, the php extension will be missing, and the Magento installation process cannot proceed.
Step 4: Setup the Database
In Step 4, proceed to set up the database by logging into MySQL using the following command:
mysql -u root -p
This command allows you to access MySQL with the root user and prompts you to enter the password when executed.
Once you are in the MySQL terminal, execute the command below to create the Magento database.
create database magento;
This sequence of commands creates a database named ‘magento,’ establishes a user ‘magento’ with the password ‘magento,’ grants all privileges on the ‘magento’ database to the ‘magento’ user, flushes the privileges to apply the changes, and then exits the MySQL terminal.
Now your database is created. To check your database, run this command:
Now, to create a user and grant the necessary privileges, run the commands below:
create user magento IDENTIFIED BY 'magento'; GRANT ALL ON magento.* TO magento@localhost IDENTIFIED BY 'magento'; flush privileges; exit;
Cloudways Magento Hosting That’s Better Than the Rest
Benefit from advanced caching, automatic scaling, PHP 8.x, and expert technical support. No need to deal with slow load times. Experience a high-powered, stable Magento store.
Install and Configure Magento on GCE
Navigate to your public IP address:
To continue with the Magento setup, copy and paste the following URL into your browser’s address bar, replacing “xx.xxx.xxx.xx” with the actual IP address or domain of your server and appending “/Magento2/setup”:
This URL will direct you to the Magento setup process in your web browser. Follow the on-screen instructions to complete the Magento installation.
If you encounter the following screen, it indicates that you are ready to install Magento on Google Cloud. Congratulations!
The first step in the Magento installation process is the Readiness Check, in which PHP details and file permission requirements are validated.
You will find the database details created in the earlier steps for Magento on Google Cloud displayed in this section.
Now, proceed to configure the store domain and admin domain for your Magento store.
Customize the fundamental details of your store based on your preferred region.
Input your preferred admin credentials for the Magento store. Take note that these credentials will serve as your login information for accessing the Magento admin panel.
Finally, check all the details highlighted below.
Following the successful installation of the Magento store, here are the screenshots showcasing both the Magento Frontend and Backend.
P.S: I trust this provides a clear perspective on why I chose Cloudways for hosting Magento on the Google Cloud server.
Frontend Store View
Backend Admin Panel View
We hope you found this guide on installing Magento Google Cloud useful. Cloudways provides the most convenient Magento hosting platform for GCE cloud servers.
For those who are interested in hosting their sites on the cloud with blazing-fast speed and top-notch optimized performance, Cloudways-managed GCE is a viable solution.
You can test and deploy your apps on Cloudways’ preconfigured testing environments and experience the best possible results for your Magento-based ecommerce stores.
Q.1: What are the benefits of Magento Google Cloud?
One of the great reasons to choose Magento Google Cloud due to its simplicity which also empowers the search engine. Hosting your Magento on Google Cloud offers many features that ensure your online stores’ stability.
Q.2: What is the easiest way to host on Magento Google Cloud?
Hosting your Magento on Google Cloud isn’t a piece of cake. However, on Cloudways, it’s very easy to host Magento on Google Cloud even if you’re not tech-savvy because it offers a 1-click Magento installation.
Q.3: How much does Magento 2 Google Cloud cost with Cloudways?
As Magento 2 is a powerful ecommerce platform to maintain its performance, we recommend you start with at least 4GB or higher server to meet our Managed Performance requirements. This will cost you $0.1172 Hourly or $84.36 Monthly.
Q.4: How can Magento on Google Cloud benefit ecommerce stores compared to other infrastructure providers available on the Cloudways platform?
The following are the points that make the GCP more compatible among different cloud infrastructure providers:
- GCP is cheaper than Amazon.
- The biggest and most powerful contender for Amazon.
- GCP Backup/restore processes are a bit slower in comparison to Amazon.
- AWS offers Quick backup/restore processes
- While hosting your Magento on Google Cloud, your bandwidth’s allocated budget may exceed as compared to other cloud infrastructure providers.
Abdul is a tech-savvy, coffee-fueled, and creatively driven marketer who loves keeping up with the latest software updates and tech gadgets. He's also a skilled technical writer who can explain complex concepts simply for a broad audience. Abdul enjoys sharing his knowledge of the Cloud industry through user manuals, documentation, and blog posts.