How To Install Drupal 7 On Amazon EC2 Ubuntu Instance

There are four steps involved in installing the drupal content management system on amazon ubuntu instance.
  1. Launching ubuntu instance.
  2. Connecting UBUNTU using SSH client Putty.
  3. Installing the LAMP stack.
  4. Installing drupal on the lamp stack.

1.Launch the UBUNTU instance on EC2

                    I have explained this in one of my tutorials. How to launch an Ubuntu instance on amazon EC2

2.Connect the Ubuntu instance using putty.

                    If you dont know to connect  the Ubuntu instance using putty, then follow the instructions given in the following tutorial . How To Connect An Amazon EC2 Ubuntu Instance Using Putty . Update the server  using the command   

sudo apt-get update

3.Installing the LAMP stack on Ubuntu instance.

1.Install MySql on Ubuntu using the command

 sudo apt-get install mysql-server mysql-client libmysqlclient15-dev 

It takes few seconds to install.It will ask for a password.Give a password of your choice and remember it. It will be used later. 

amazon ec2 sql password
sql password
2.Install Apache2 using the command

 sudo apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert

3.Install php using

sudo apt-get install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-mcrypt php5-mysql php5-ps php5-pspell php5-recode php5-xsl

4.Install php myadmin using

 sudo apt-get install phpmyadmin

Select Apache using space bar during installation. It is shown in the figure below.

Ec2 apache selection
selecting apache

After selecting you will be asked if you want to configure with database. Select yes and provide the databse password you have given during MySql installion.[note:you have to enter the password three times]
once you complete the above steps, you are done with the LAMP stack installation.

After installing the LAMP stack we have to install the drupal installation file in the www folder. Inorder to locate that folder do the following steps.

 cd /etc/apache2

                  [apache2–> apache configuration file]

                 2. # ls [shows all the folders inside apache2]


 cd sites-enabled

[sites enabled is a folder inside apache2]
                4. # ls [shows 000-default  file inside sites-enabled]

 nano 000-default

[ opens 000-default file]

www folder contains the index.html file, which will be there by default.
6. Now go to drupal website and copy the link of the installation file. []

7. To download drupal to your Ubuntu server type the following code

 sudo wget 

while doin this make sure you are on cd  /var/www folder]

8. Once drupal gets installed go to # cd /var/www and type

sudo rm index.html

[removes the index.html file from the www folder]

9. The installed drupal file will be in .tar format, so inorder to extract it , type

 sudo tar -zxvf drupal -7.18.tar.gz

10. Now change the owner to apache to write to your file system using

 sudo chown www-data:www-data -R drupal-7.18

11. Now  public DNS of your Ubuntu instance [Eg:]
and paste it in the adress bar and load it. you can see the drupal files in the browser as shown in figure below.

drupal isntall
drupal install

12. Click drupal-7.18 and continue the installation process.During the process it will ask for database name, user name and password. Now open a new tab and type your ec2 public dns followed by phpmyadmin    eg: You will have to provide the user name as root and password is one which you used during the sql installation. Once you enter the credentials click login.

13. Go to–>Privileges–>add new user Enter the user name,password of your own. Give the host name as localhost . And under database user click the second option and click create user. Give the information’s as shown in the following figure.

14.Now go back to the tab where we left and enter the database name , database username, database password and click save and continue .You have the give the site information once drupal gets initialized.

14. Inorder to point the DNS to drupal you have to put all the drupal files in one foldr and put it inside the www folder. go to putty and type the following codes.

sudo mv drupal7.14 drupal

cd /etc/apache2/sites-enabled

sudo nano 000-default

[add drupal to /var/www/

drupal] save and close it

15. Restart apache using # sudo  

cd /etc/init.d/apache2 restart

You are done!! . You can manage your drupal using your dns of ubuntu instance.


Pin It on Pinterest

Share This