Installing WordPress on AWS

mrjain 66,002 views 39 slides Jul 09, 2012
Slide 1
Slide 1 of 39
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39

About This Presentation

A complete step by step tutorial to install WordPress on Amazon's AWS platform. Using EC2, EBS, RDS and S3.


Slide Content

July 2012
Installing WordPress on AWS
EC2 RDS S3

Elastic Compute
Cloud (EC2)
RDS
MySQL
Simple
Storage
Service (S3)
Users
Internet
The AWS
infrastructure
for this tutorial

Create your free account on AWS -  http://aws.amazon.com/free/

Part One: Create an EC2 instance In AWS-speak creating a new virtual server is called an
“instance”. “Spinning up an EC2 instance” is a phrase
you will hear quite often which just refers to starting a
new EC2 instance.

Step 1: From the AWS Management Console click on the EC2 tab

Step 2: Click on “Launch Instance” and select Classic Wizard

Step 3: Select Amazon Linux AMI
(The star next to the name means it’s part of the free tier plan)

Step 4: Select the Micro (t1.micro) instance
(The star next to the name means it’s part of the free tier plan)

Step 5: Use the defaults

Step 6: Enter the name of the server to identify it later in the interface

Step 7: Enter a name for your key pair, then download it
(this file is VERY important since it contains the credentials to connect to your EC2 instance)

Step 8: Add rules to the default Security Group to allow inbound access to EC2
(port 20-21 = ftp, port 22 = ssh and port 80 = http)

Step 9: Select your new Instance and right click on it
(this contains some very useful information you might need later on)

Part Two: Configure your EC2 instance Now that the EC2 instance has been created it’s time to
install the LAMP (Linux, Apache, MySQL and PHP) stack
which we’ll need before you can install WordPress. The
Linux kernel was preinstalled when the EC2 instance was
created. Apache and PHP will be installed in this section.
The next section will deal with MySQL

There are two ways you can connect to EC2, one is to right click on the EC2 instance
name and launch a Java SSH client. The other way is to use a command line SSH client
such as Terminal.app on the Mac. This tutorial will use Terminal.
Step 1: Connect to the EC2 instance

From Terminal go to the directory that contains <filename>.pem (the file contains your credentials to
access the EC2 instance.)
Change the permission of the file:
chmod 400 <filename>.pem
Connect to your EC2 instance:
ssh -i <filename>.pem [email protected] (use your actual Elastic IP address)
Switch to superuser:
sudo su
Install any new updates:
sudo yum update
To install Apache:
yum install httpd
Start service:
service httpd start
Start service automatically:
chkconfig httpd on
Install PHP:
yum install php php-mysql
Restart Apache web service daemon:
service httpd restart
Step 2: Install Apache and PHP

Part Three: Create an RDS MySQL* instance * The fine print. As of July 2012 AWS only offers a free 2 month trial of RDS MySQL. An alternative is to install
MySQL on your EC2 instance.

Step 1: Click on the RDS tab and select Launch DB Instance

Step 2: Select MySQL Community Edition

Step 3: Select db.t1.small, no for Multi-AZ
(db.t1.small is part of the Free Trial. Remember the Master User Name and User Password for WordPress)

Step 4: Enter a Database Name
(Remember the Database Name for WordPress)

Step 5: Select the defaults

Step 6: Select Launch DB Instance

Step 7: The database may take 5 minutes to create

Step 8: Click on DB Security Groups and click on Create DB Security Group

Step 9: Call it WordPress and click Yes, Create

Step 10: Click on Select and pick EC2 Security Group

Step 11: Click on Select and pick CIDR/IP
(Enter 0.0.0.0/0 This is NOT recommended for production deployments)

Step 12: Click on your database and review the information
(Remember the Endpoint for WordPress)

Part Four: Install WordPress WordPress will be installed at the root of your EC2
Instance.

From Terminal go to the directory that contains <filename>.pem (the file contains your credentials to
access the EC2 instance.)
Change the permission of the file:
chmod 400 <filename>.pem
Connect to your EC2 instance:
ssh -i <filename>.pem [email protected] (use your actual Elastic IP address)
Switch to superuser:
sudo su
Change to the root directory:
cd /var/www
Download the latest WordPress package:
wget http://wordpress.org/latest.tar.gz
Extract WordPress:
tar -xzvf latest.tar.gz
Move WordPress to the html folder:
rmdir html
mv wordpress html
Delete the WordPress tar file:
rm latest.tar.gz
Step 1: Install WordPress

Create and edit the config file:
cd html
mv wp-config-sample.php wp-config.php
vi wp-config.php
Quick VI tutorial – Press  i for edit mode. Press  Esc on your keyboard after your are done editing. Then
type :wq to save the file and quit VI.
You will need to edit the following entries in the config file with the values from your RDS MySQL
instance:
define(‘DB_NAME’, ‘wordpress’);
define(‘DB_USER’, ‘root’);
define(‘DB_PASSWORD’, ‘YOUR_PASSWORD’);
define(‘DB_HOST’, ‘localhost’);
Below is a mapping of the WordPress config file and the RDS MySQL instance:
‘DB_NAME’ = Database Name
‘DB_USER’ = Master Username
‘DB_PASSWORD’ = Master User Password
‘DB_HOST’ = Endpoint
Step 2: Edit the WordPress config file

Step 3: Point your browser to the EC2 Elastic IP address and Install WordPress

Part Five: Configure S3 S3 will be used to serve up media images (jpg, png,
etc...) on the WordPress blog. S3 uses the term
“bucket”, think of it as a container for your files. The
bucket name has to be unique across the entire S3
platform.

Step 1: Click on the S3 tab and select Create Bucket

Step 2: Enter a bucket name

Step 3: Click on Upload and upload an image
(Use the S3 link when creating a blog post in WordPress)

Done. Now What? Make things and break things to learn how all the various
services of AWS work together. Visit Amazon for more
tutorials at:
http://aws.amazon.com/articles/

Manish Jain
http://celestri.org
Created by:
[ v1.0 - July 2012 ]