7K Views

Magento 2 Installation on Google Cloud via Composer

Introduction:

 

In our previous blogs, we discussed on creating a Compute Engine VM instance and installing LAMP server on Google Cloud Platform(GCP). In this blog, we will discuss about installing magento2 on google cloud platform(GCP). For installing magento on GCP, you will need a registered GCP account. You can then create a  VM on google cloud to setup a LAMP server and finally install magento framework on it.

 

Create a VM on GCP and Setup LAMP server:

 

For installing magento2, we will need to setup a LAMP server on GCP. For this blog, we will use the following LAMP configurations:

 

  • OS: Ubuntu 16.04
  • Database: MySQL 5.7
  • PHP: php v7.0

 

First of all, we need to create a Compute Engine VM on GCP along with a MySQL database using SQL service of GCP. Then you setup LAMP server on it for installing magento. You can follow my blog for the steps for creating and connecting to Compute engine VM and setting up a LAMP server.

 

Download Magento2:

 

Now let us download and install the latest source code from github. At the time of this blog, the latest version is 2.2.6.

To install magento2 with composer, first create the Access keys of magento marketplace. If you have an account on Magento Marketplace, simply signin and generate the access keys. If you don’t have an account, create an account by registering yourself on marketplace.magento.com

For generating Access keys, login in to magento marketplace and from the top right corner of the page where your user name is displayed, navigate to My profile > Marketplace > My products > Access Keys

Now create a new pair of Access keys. You need to provide the public Key as username and Private Key as password when prompt.

First install composer on the server.

 

 

The syntax for installing magento2 through composer is as follows.
composer create-project –repository=https://repo.magento.com/ magento/project-community-edition <install-directory-name>

You can use the below command for installing magento2 latest version through composer.

 

 

For installing a specific version of magento2, mention the magento version at the end of the command as follows.

 

 

During this process, you will be asked to provide the username and password. Provide the generated Access Keys where the public Key is the username and Private Key is the password. Also, you will be asked whether you want to store the credentials in auth.json. You can select “n” if you don’t wish to save your credentials on the server.

Then copy the magento2 files to the Document root of the webserver.

 

 

Give the proper web-server permissions.

 

 

 

Configure Apache:

 

Configure the Apache with the below configuration. If you need to run the magento on a domain , uncomment the ServerName and ServerAlias  section and update your domain name. Else you can leave it as it is.

 

 

 

Restart Apache server.

 

 

Create a MySQL Database and User:

 

Login to your MySQL server and create a user and database for your Magento application. Change the database name, database user and password as per your need.

 

 

 

Installing Magento2:

 

You can install magento2 by hitting the public IP of the instance or the domain name if configured in DNS on the web browser.

 

 

Follow the web GUI interface and provide the required information to install magento2 on the server.

 

 

Note: If your installation screen on web browser seems stuck, you can also check the installation logs to check if the installation is complete.

 

 

After the installation of magento2 is complete, you can access the frontend and backend with the associated URLs. You can note the admin URL displayed after the installation is complete.

 

 

 

Congrats, you have successfully installed Magento2 on Google Cloud Platform.

Stay Connected!

 

You can also check Cloudkul GCP hosting plans for Magento 2 and other e-commerce platforms.

In case of any help or query, please contact us or raise a ticket at [email protected].

 

. . .

Comment

Add Your Comment

Be the first to comment.

css.php