How to make WordPress on EC2! - February 16, 2011 at 3:38 pm

In this exercise we will show the steps to setting up a AWS EC2 server, connect over ssh and install all the tools and config WordPress. I have attached a video to each step and it might make more sense to read the steps, watch the video and then try them yourself. If you are using windows you will need to follow this post to connec to to AWS.

1.     First we will need to log into the AWS console and launch a server. Please log in and launch a server with the following-

a.      AMI ID = Ami-84db39ed

b.     Instance Type = micro

c.         Tag = wp

d.      Keypair = wptest

e.     Security group ports 22 and 80 from 0.0.0.0/0

Here is a video to watch

2.   Connecting to the server we will use terminal. In order to do this we will need to use the PEM we downloaded in step one. We also need to change the permissions of the PEM file with the chmod command. First open terminal and change directories to the location of the PEM we downloaded, mine is in the downloads folder

cd Downloads

Next we need to chmod 400 the PEM file.

chmod 400 wptest.pem

Then last we need to connect to the server

            ssh –i wptest.pem root@ec2-12-34-55-23.amazon.com

Here is a video to watch

3.     Now we need to install apache, MySQL and some PHP modules. To do this we will use the YUM package manager. The command we will typ in is the following-

Yum install httpd mysql-server phpmyadmin –y

                        Here is a video to watch

4.     More configuration is needed to get WordPress up and running. Now we will download wordpress with the tool wget-

wget http://wordpress.org/latest.zip

                        Next we need to start MySQL

                                    /etc/init.d/mysqld start

                        Now we need to run the mysql secure installation

                                    /usr/bin/mysql_secure_installation

                        Next start apache

                                    /etc/init.d/httpd start

                        Now we need to modify the configuration file for phpmyadmin.

                        We open the file with the VI command line editor-

                                    vi /etc/httpd/conf.d/phpMyAdmin.conf

                        We need to modify the allow from line. In the example we will remove 127.0.0.1 and replace with all, normally you would only allow this from your public IP address using whatismyip.com. After your make this change you need to restart the apache server with the following command –

                                    /etc/init.d/httpd restart

 

                        Here is a video to watch

5.   Now you need to get wordpress zip file that you downladed and get that in the web directory /var/www/html/. To do this we will use the move command –

mv latest.zip /var/www/html

                        Now we need to navigate to the lateset.zip

                                    cd /var/www/html

                                    ls -la

Now we need to unzip the file-

                                    Unzip latest.zip

                        Now move to the uzipped directory

                                    cd wordpress

Now move all the files in the WordPress directory back to /var/www/html

                                    mv * ..

                        Here is a video to watch

6.     Now we will connect to phpMyAdmin to create a DB and a DB user.

First connect to the new EC2 on port 80 and validate that apache is working you should see the apache test page. Second you need to go to phpMyAdmin and enter in the user = root and the password you set up during the mysql secure installation. Third you need to create a WordPress user and a WordPress database.

Here is a video to watch

7.   Now we are on to the final step! First you will need to connect to the EC2 server on port 80 to finish the wordpress installation. You will need to use the same user and pass we set up in phpMyAdmin in the WordPress install screen. Next we need to create the wp-config.php using the vi command, all the info we need to use is created for us so we just need to copy and paste the info in to the config file.

vi /var/www/html/wp-config.php

Next click the run install button. Now we are ready to log in to the WordPress admin and start blogging!

Remember you MUST shut down the servers when you are done or you will pay for them!!

RSS

Tags: , , , , ,

Leave a Reply