How To Install and Setup Drupal On Amazon EC2 Instance?

Bibin Wilson
Bibin Wilson
How To Install and Setup Drupal On Amazon EC2 Instance
Table of Contents
Table of Contents

In this guide, I will explain how to install and setup Drupal on Amazon ec2 ubuntu 14.04 server. This is a standalone installation with Drupal and a database on a single server.

For high-traffic websites, it is advised to have a high-availability architecture with autoscaling and dedicated database instances.

If you need help deploying Drupal in HA mode, you can mail us at admin@comtechies.com

Install and Setup Drupal on Amazon EC2

To set up Drupal on an EC2 instance, you need the following on the server.

  1. LAMP stack.
  2. Few PHP modules related to Drupal
  3. A dedicated database for Drupal.

Follow the guides given below to set up a working Drupal installation.

Spin Up an EC2 instance

Spinning up an EC2 instance is really easy. Follow this tutorial if you haven't done that before. How to Spin Up an Ec2 Instance

Add Relevant Security Groups

Add the relevant port in the ec2 instance security group. In our case, we would require port 80 and 22. If you are setting up SSL in the future, you might need to add 443 as well.

Connect to the new instance

You can follow this tutorial to connect to the instance using putty. How to connect EC2 instance using putty

Install LAMP Stack

1. Update the server. sudo apt-get -y update2. Install the lamp stack. sudo apt-get -y install lamp-server^Give a password when it prompts for it.

  1. Verify the Apache installation by visiting the public IP of your instance. You should get a default Apache page on your browser.

  2. Verify MySQL server status

sudo service mysql status

Install PHPMyAdmin

sudo apt-get install phpmyadminOpen /etc/apache2/apache2.conf and add the following at the end of the line. Include /etc/phpmyadmin/apache.confRestart apache2 sudo service apache2 restartNow you will be able to access PHPMyAdmin over the browser by appending phpmyadmin to the IP as shown below. http://52.34.132.67/phpmyadmin/

Create a Database and User

Log in to the database. mysql -u root -pCreate database CREATE DATABASE drupaldb;Create a Drupal user. CREATE USER drupaluser IDENTIFIED BY 'password';Grant all privileges to the Drupaluser. GRANT ALL PRIVILEGES ON drupaldb.* TO drupaluser;FLUSH PRIVILEGES;exit database. exit;

Install PHP modules

sudo apt-get updatesudo apt-get install php5-gd php5-curl libssh2-phpOpen /etc/php5/apache2/php.ini, search, and set the following parameters to off. expose_php = Off

allow_url_fopen = Off


Enable Apache rewrite functionalitysudo a2enmod rewrite

Open /etc/apache2/sites-enabled/000-default.conf and change parameters as shown below.

Note: Replace example.com with your domain name and webmaster@example.com with your email address.

<VirtualHost *:80> ServerName example.com ServerAdmin webmaster@example.com DocumentRoot /var/www/html <Directory /var/www/html> AllowOverride All </Directory> </VirtualHost>

Restart apache

sudo service apache2 restart

Download Drupal Files

Go to https://www.drupal.org/download

Download the latest version

https://ftp.drupal.org/files/projects/drupal-8.0.5.tar.gz

until the files

sudo tar -zxvf drupal-8.0.5.tar.gz

cd into the extracted Drupal directory and copy all the files to /var/www/html using the following command.

cd drupal* sudo rsync -avz . /var/www/html

Set permissions of user and group

sudo chown -R www-data:www-data /var/www/html

Install and Setup Drupal

Now, access the install page in the browser using the public IP of your instance and continue as normal Drupal installation. Give the database username and password that you have created during the database setup process.

That's it. Once you complete the web-based installation, you will have a working Drupal Website.



Great! Next, complete checkout for full access to ComTechies - Become an SEO & Marketing Expert
Welcome back! You've successfully signed in
You've successfully subscribed to ComTechies - Become an SEO & Marketing Expert
Success! Your account is fully activated, you now have access to all content
Success! Your billing info has been updated
Your billing was not updated