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 database in 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 in deploying drupal in HA mode, you can mail us at email@example.com
Install and Setup Drupal on Amazon EC2
To setup 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
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 update
2. Install the lamp stack.
sudo apt-get -y install lamp-server^
Give a password when it prompts for it.
3. Verify the apache installation by visiting the public IP of your instance. You should get a default apache page on your browser.
4. Verify MySQL server status
sudo service mysql status
sudo apt-get install phpmyadmin
Open /etc/apache2/apache2.conf and add the following at the end of the line.
sudo service apache2 restart
Now you will be able to access phpmyadmin over the browser by appending phpmyadmin to the ip as shown below.
Create Database and User
Login to database.
mysql -u root -p
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;
Install php modules
sudo apt-get update
sudo apt-get install php5-gd php5-curl libssh2-php
Open /etc/php5/apache2/php.ini, search and set the following parmeters to off.
expose_php = Off allow_url_fopen = Off
Enable apache rewrite functionality
sudo 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 firstname.lastname@example.org with your email address.
<VirtualHost *:80> ServerName example.com ServerAdmin email@example.com DocumentRoot /var/www/html <Directory /var/www/html> AllowOverride All </Directory> </VirtualHost>
sudo service apache2 restart
Download Drupal Files
Go to https://www.drupal.org/download
Download the latest version
untar 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.