Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Installing WordPress on AWS

Installing WordPress on AWS

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

Manish Jain

July 11, 2012
Tweet

More Decks by Manish Jain

Other Decks in Technology

Transcript

  1. What is Covered Slide Topic 3 Architecture Overview 4 Signup

    for AWS 5-13 Part 1: Create an EC2 Instance 14-16 Part 2: Configure your EC2 Instance 17-27 Part 3: Create an RDS Instance 28-33 Part 4: Install WordPress 34-37 Part 5: Configure S3 38 Done.
  2. Elastic Compute Cloud (EC2) RDS MySQL Simple Storage Service (S3)

    Users Internet The AWS infrastructure for this tutorial Elastic Block Store (EBS)
  3. 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. EBS refers to the “hard drive” that is attached to the EC2 instance. It’s where all the system files will reside.
  4. Step 2: Click on “Launch Instance” and select Quick Launch

    Wizard (Enter the Instance name, create a new key and select the Amazon Linux AMI)
  5. Step 3: Select Amazon Linux AMI (Under Instance details make

    sure t1.micro is selected it’s part of the free trial, then select Launch)
  6. Step 5: Add rules to the Default Security Group to

    allow inbound access to EC2 (port 20-21 = ftp, port 22 = ssh and port 80 = http)
  7. Step 7: Right click on the IP address and select

    Associate. Assign it to your new instance.
  8. Step 8: Select your new Instance and right click on

    it (this contains some very useful information you might need later on)
  9. 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. MySQL will be installed in the next section.
  10. 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
  11. 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 ec2-user@[Elastic IP] 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
  12. 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, those instructions are included in the appendix.
  13. 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)
  14. Step 10: Click on your database and review the information

    (Remember the Endpoint for WordPress)
  15. 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 ec2-user@[Elastic IP] 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 Change permissions on the directory: cd /var/www/ chmod o+w html cd /var/www/html sudo chown ec2-user . Step 1: Download WordPress
  16. 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.
  17. Step 3: Click on Upload and upload an image (Use

    the S3 link when creating a blog post in WordPress)
  18. Done. Now What? Make things and break things to learn

    how all the various services of AWS work together. Visit AWS for more tutorials at: http://aws.amazon.com/articles/
  19. [ v1.2 - July 2012 ] Created by: Manish Jain

    The backstory to why this presentation was created can be found on my blog at: http://celestri.org/
  20. Create and edit the config file: cd /var/www/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 Instructions to manually edit the WordPress config file
  21. 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 ec2-user@[Elastic IP] Switch to superuser: sudo su To install MySQL: yum install mysql-server Start MySQL: service mysqld start Start the service automatically: chkconfig mysqld on Create the wordpress database: mysqladmin -uroot create wordpress Secure your database installation: mysql_secure_installation Instructions to install MySQL on the EC2 instance