Quantcast
Channel: Urban Yoda » Sage Adams
Viewing all articles
Browse latest Browse all 10

Creating an AWS Drupal Site with LAMP and PHPMyAdmin

$
0
0

I was at first leery about this project. I’m a long-time Windows user who has been aching to move on. This is just the first step. After this I’m building my own machine and installing Ubuntu as my primary OS. But first I’m installing Linux, et. al on AWS. That’s what this post is about; a future one will tackle the computer build.

In this post we’ll explore how to setup an AWS free tier account, with Ubuntu Linux, LAMP, and PHPMyAdmin. Then we’ll add Drupal as our CMS. We’ll also look at how to access your new AWS site with Filezilla and how to SSH into it with Putty (I’m still on Windows as we speak unfortunately).

Step 1: Setting up an AWS Account

This is the easy part. Just go to aws.amazon.com and click ‘Create an AWS Account’ and follow the directions. If you already have an Amazon account that makes it easy because you can just login with those credentials to get started. Once you login you’ll be presented with a large list of Amazon Web Services and associated icons. Click ‘EC2’ to make your web host. Input all the other information they request (credit card and address, etc.). Choose ‘Ubuntu’ as your free server OS. Once you’ve got your instance going you’ll want to setup your security policy and enable SSH, HTTP, and HTTPS as incoming connections. See here for more information setting up your security policies (at bottom). Actually, read that whole article and follow all those directions. If you don’t do everything on that page do make sure you also create and download your key pair. That’s very important.

Step 2: Setup Putty and Access your New Linux Instance with the Terminal

Read this.

Step 3: Install LAMP

You already have the ‘L’ installed, so now let’s add Apache, MySQL Server, and PHP. But first, update your Ubuntu package manager and the installed packages, like so:

sudo apt-get update
sudo apt-get dist-upgrade

Then, install Apache (and packages), like so:

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

Easy. Now, enable the rewrite module in Apache:

sudo a2enmod rewrite

Ok, great. Now, install PHP5 (and useful packages):

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

Restart Apache (installing php – above – might automatically do this for you):

sudo /etc/init.d/apache2 restart

Type your IP address for your AWS instance into your browser to make sure Apache is running.

Now, install MySQL (and packages):

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

Create a root password you won’t forget (or write it down somewhere secure). Now, let’s install PHPMyAdmin. When prompted for a password (3 times) type in the password you setup earlier when you install MySQL.

sudo apt-get install phpmyadmin

Now you need to add PHPMyAdmin to the Apache configuration, so do this:

sudo nano /etc/apache2/apache2.conf

Scroll to the bottom of the screen and insert the following:

# Include web access to phpmyadmin
Include /etc/phpmyadmin/apache.conf

Finally, restart Apache again and then go to your IP/phpmyadmin in your browser. Login with the root as your username and the password you setup earlier.

Step 4: Access your new Server with Filezilla

Obviously, make sure download and install Filezilla on your computer first. Then open up the program and select File > Site Manager.

Do all of this.

Use ‘ubuntu’ as your username. You won’t need a password because you’re using your key.

Step 5: Install Drupal

Visit the drupal.org site and copy the tar.gz link for the version of Drupal you want to use. In your terminal in thevar/www/html folder do the following:

First, type (changing 7.36 to whatever version Drupal is on when you read this):

sudo wget http://ftp.drupal.org/files/projects/drupal-7.36.tar.gz

Then type:

sudo rm index.html

Now extract the drupal file you downloaded:

sudo tar -zxvf drupal-7.36.tar.gz

Now, change the owner:

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

Now, if you go to your browser and type in your IP address (or public DNS) you’ll see links to the drupal files. Just click the drupal folder to get started with the installation! If you know how to install Drupal the rest should be easy. You also have PHPMyAdmin installed so open that open with youripaddress/phpmyadmin and create the database to use for Drupal.

I recommend when creating the database in phpmyadmin to first create a new user under ‘Users’ and use localhost as the Host. An easy way to set everything up is to name your user and database the same thing. So give your user a name and after adding localhost and entering your password twice, select the option that says ‘‘.

Now, finally, let’s change a few more things so you can access your Drupal site when you go to the DNS directly (instead of at dnsName/drupal-7.36 (as it is now).

First, go back to your terminal and make sure you’re in the /var/www/html folder. Now, do the following command to make your folder name easier to use:

sudo mv drupal-7.36 drupal

Next, type this:

cd /etc/apache2/sites-enabled/

Then, let’s edit the file there:

sudo nano 000-default.conf

Finally, change the line that begins with DocumentRoot to /var/www/html/drupal.

Restart Apache and you should be good to go.

Image courtesy of Flickr: https://www.flickr.com/photos/medithit/10363854753

Viewing all articles
Browse latest Browse all 10

Trending Articles