Hosting a WordPress.org Blog using Amazon Web Services

WP-OnAWS-F

With tools like WordPress and Amazon Web Services, it’s easy to establish a presence on the Internet. Of course there is more to it than just having a website. There are a lot of aspects to hosting and running a website, but for casual use, this is a great way to start. WordPress itself is an excellent tool for both the novice user or the knowledgeable. A simple blog can be up with little effort, but with some time and knowledge, it can be a fully robust content manager. Amazon Web Services (AWS) offers an affordable, and sometimes free, way of utilizing a wealth of services such as hosting and storage. We will be using a service from AWS called Elastic Cloud Computing (EC2). This is an example of Infrastructure as a Service. EC2 allows you to have access to a server without actually having to physically have the machine.

Setting up Amazon Web Services

To get started, set up an account with AWS. This does require payment information, but the services we will be using qualify under Amazon’s “Free Tier” service which is available to all accounts less than 12 months old. Once that is set up, navigate to your console.

From there you should see a screen that looks about like this:

Click on EC2 and along the right hand side of the page, click on Instances. We will be setting up a micro instance of an Ubuntu 12.04 server. Amazon offers several other options for servers, several of which fall under the Free Tier.

  • Once you’ve found yourself on the Instance page, along the top is a button labeled “Launch Instance.”

  • A pop up screen will appear where you should select “Classic Wizard” and click continue.

  • Under the “Quick Start” tab, find “Ubuntu Server 12.04.02 LTS and click “Select”

  • On the next screen, ensure that in the drop down menu labeled “Instance Type” that T1 Micro is selected

  • Simply Click continue until you reach the screen that asks about creating Key Pairs.

Name the Key Pair anything you want. and then click on “Create & Download your Key Pair.” Depending on your browser, they key pair will download or notify you to download. Once the file is downloaded, the Continue button will once again turn yellow. Click to move on to Security Groups.

Security Groups

Security Groups act much like firewalls. The Default for AWS EC2 is to block all ports. We will need to allow port 22 so we can access the server via ssh and port 80 so eventually we can access your WordPress Site via http.

  • On your current screen, select “Create a New Security Group.”

  • There is a space for “Group Name” and “Group Description.” Fill both of these in however you see fit.

  • Where is says “Port Range:” enter 22 and click “Add Rule.”

  • Do that again, but instead enter 80.

  • You should see something like this:

Once again, click “Continue.” You will then be presented with an overview of all your settings. Be sure that you are running a micro instance as any others will incur a cost. When you are satisfied, click “Launch!”

Click “Close” and you will be brought back to your list of instances, where the instance you just setup should appear. We are now going to connect to that server via ssh (Secure Shell).

Connecting to Server

If you right click on the listing of your instance, a drop down menu will appear. Click on “Connect.” Another screen will pop up about “Connecting to your Instance.” From here we can either connect using a provided java-based terminal, or using a stand alone terminal. Mac and Linux users can use the Terminal and basic ssh command and Windows users have the option of putty. Instructions can be found under that tab. We are going to go ahead and just use the java-based terminal.

  • There will be a field for “Private Key Path:” Here you will enter the path to that key file you downloaded earlier.

  • Assuming you did not specify a different path, it will be somewhere in your download file.

  • Once you’ve located it, enter that path into that field. It should end in .pem.

  • Click Run on any Java warnings.

  • Click yes when you are asked to add to list of known hosts.

If everything was successful, you will now be connected to your server with a command line interface.

Installing the LAMP Stack

Apache

This is the part where we begin to set up your WordPress page. There will be several steps to get to the WordPress install itself, as it requires a few tools in order to work appropriately. We are going to start with the install of Apache.

  • Enter “sudo apt-get install apache2”

  • Apache will need restarted to reset any setting so enter “sudo service apache2 restart”

  • Test that your apache server is working by opening a browser and going to “http://localhost”

    • Local host refers to the URL of your EC2 instance which can be found on the instance console under the label Public DNS and will look something like: ec2-xxx-xx-xxx-xxx.compute-1.amazonaws.com

  • You should see a page that reads “It Works”

php

We now need to install php.

  • Enter “sudo apt-get install libapache2-mod-php5:

  • Enable php for apache by entering “sudo a2enmod php5”

  • Apache will need to be restarted to include the new settings. Do this by entering the same restart command “sudo service apache2 restart”

  • We now need to test to ensure that php is working appropriately

    • Navigate to /var/www and create a file called “test.php”

    • Open file in editor of your choosing and enter “<?php phpinfo(); ?>” Be sure to open with sudo or you won’t be able to edit.

    • Save the file and restart apache once again.

    • In your browser, go to “http://localhost/test.php”

    • You should see a page with the php settings.

  • Back in the terminal, navigate back to your home directory.

mySQL

Next it’s on to installing mySQL.

  • Enter “sudo apt-get install myql-server” where you will be prompted to set a password

  • Enter “sudo apt-get install libapache2-mod-auth-mysql”

  • Enter “sudo apt-get install php5-mysql”

  • Start up SQL by entering “mysql -u root -p” where you will be prompted to enter the password you set earlier.

  • Once presented with the prompt “mysql>” enter, “CREATE DATABASE databasename;”

WordPress itself

Finally on to WordPress

  • Navigate to your /var/www/ directory.

  • Enter “sudo wget http://wordpress.org/latest.tar.gz” This downloads the wordpress files directly from the source.

  • Enter “sudo tar -zxvf latest.tar.gz”

  • You should now have a directory called “wordpress” in your /var/www/ directory.

  • Restart apache: “sudo service apache2 restart”

  • Go to your browser and go to “http://localhost/wordpress”

    • You should see a page that is asking you to set up your wp-config file.

    • On the next page, use the name of the database you created in the previous section

    • Use “root” as the username (unless you created another username) and enter the password you set initially.

    • Keep both Database Host and Table Prefix as is and click “Submit”

    • Fill in the information on the Welcome page as you see fit. When you are satisfied, click “Install WordPress”

Congratulations. You have successfully installed WordPress on your very own server! This gets you a place on the Internet, but it still needs some work. This is just a fraction of what is required to run a successful website. Maintaining a sever can be hard work and ensuring it is totally secure can be a little tricky. With this tutorial, it takes no time get started and introduced to the world web design and development, but it will still take years to master.

 

One Comment on “Hosting a WordPress.org Blog using Amazon Web Services”

  1. As mentioned in the blog, The blogs plays a very important role in success of any business. Since, there are many varieties available in its creation. WordPress is one of the most used and interesting one among them. I probably use joomla with it for my creations.

Leave a Reply

Your email address will not be published. Required fields are marked *