This topic describes how to use Drupal to deploy an e-commerce website on an ECS instance that runs CentOS 7.

Prerequisites

You must have registered an Alibaba Cloud account before you follow the instructions provided in the tutorial. If not, create a new Alibaba Cloud account first.

Background information

Drupal is a free and open source content management framework (CMF) written in PHP. Drupal consists of a content management system (CMS) and a PHP development framework. You can use Drupal to build dynamic websites that provide various features and services. Drupal is commonly used in a variety of applications, from personal blogs to large communities.

The procedure described in this topic is applicable to users that are familiar with Alibaba Cloud ECS instances and Linux, but new to website construction on ECS instances.

Project configuration

The following software versions are used in this procedure. The operations may vary depending on the versions of your software.
  • Operating system: CentOS 7.2
  • Apache: Apache 2.4.25
  • MySQL: MySQL 5.7.17
  • PHP: 7.1.1
  • Drupal: 8.1.1

Procedure

To build a Drupal website on an ECS instance, perform the following steps:
  1. Step 1: Activate an ECS instance
  2. Step 2: Deploy the web environment
  3. Step 3: Install Drupal

Step 1: Activate an ECS instance

Activate an ECS instance to build a small-sized website for personal use. Later, you can upgrade the instance or optimize the architecture based on your needs.

Step 2: Deploy the web environment

You can deploy the web environment on the ECS instance in any of the following ways:
  • Image deployment
  • Deployment by using an installation package
  • Manual deployment: Build the environment by using the source code or Yellowdog Update, Modified (YUM).

For new users, we recommend that you use an image to deploy the web environment. This is an easy way to set up a web environment. If you have some basic knowledge of Linux operations and maintenance, you can use an installation package, the source code, or the YUM utility to customize the web environment. This topic describes how to build a Drupal website by using an image.

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Instances.
  3. In the top navigation bar, select a region.
  4. On the Instances page, click Create Instance.
  5. In the Image section of the Custom Launch tab, choose Marketplace Image > Select from image market (including operating system).
  6. Enter LAMP in the search bar and select the image that matches your operating system. Select a LAMP image that is suitable for CentOS 7.2.

    You can also go to Alibaba Cloud Marketplace to search for and purchase the images that you want to use.

  7. Click Apply.
  8. On the Custom Launch page, scroll down to the Image section. The custom image you purchased is automatically selected. Complete other settings and activate the ECS instance as instructed. For more information, see Create an instance by using the provided wizard.

Step 3: Install Drupal

To install Drupal, perform the following steps:

  1. Download the Drupal installation package:
    wget http://ftp.drupal.org/files/projects/drupal-8.1.1.zip
  2. Decompress the package to your website root directory:
    unzip drupal-8.1.1.zip 
    mv drupal-8.1.1/* /var/www/html/
  3. Specify the owner and group of the sites directory:
    chown -R apache:apache /var/www/html/sites
  4. Restart the Apache service:
    # /etc/init.d/httpd restart
  5. In the address bar of your browser, enter <Public IP address of an ECS instance>/index. php to go to the Drupal installation page. Select the required language from the Choose Language drop-down list, and click Save and continue.
    Select the required language
  6. Select Standard, and click Save and continue.
  7. Enter database information, and click Save and continue.
    Note After you log on to the MySQL database, you can run the following commands to set the database information:
    • DBNAME: database name
    • UAERNAME: username
    • IP: localhost or 127.0.0.1 for a local host
    • YOURPASSWORD: database password
    mysql> CREATE DATABASE DBNAME;
    mysql> CREATE USER UAERNAME;
    mysql> GRANT ALL PRIVILEGES ON *. * TO 'UAERNAME'@'IP' IDENTIFIED BY 'YOURPASSWORD' WITH GRANT OPTION;  
    mysql> FLUSH PRIVILEGES;
  8. After the installation is complete, go to the website settings page, enter site information, and then click Save and continue.

What to do next

After the installation, you can customize your website pages.