Skip to main content

Moving WordPress to Amazon EC2

I decided to move my small project from GoDaddy 4GH Hosting to Amazon EC2 using their micro instance.

Here's how I did it.

I am an existing Amazon customer, so I decided to use the same email address and password to access AWS Amazon. I am using Amazon S3 for backup, and use my account to buy books.

  • In EC2 Dashboard, you will see "Launch Instance" to initiate your first server at Amazon cloud.
  • I've used the Classic Wizard to launch  the setup, click continue.
  • In choose an AMI, you have the option to select from the Quick Start, My AMIs, Community AMIs, and Marketplace. For this guide, let's use Amazon Linux AMI 2012.03 package, it includes Linux 3.2, AWS tools, and repository access to multiple version of MySQL. I click Select 64 bit to proceed.
  • Select Launch Instances, availability zone, select default no preference, then click Continue.
  • In Key, I simply use my domain name, click Continue.
  • Select "Create a new Key Pair" using your domain name for simple management of keys.
  • Choose one or more of your existing Security Groups. I prefer to create a new group for a new project.
Firewall Policy example:

Custom Rule, Port Range 20-21 (
Custom Rule, Port Range 14000-14050 (

  • Click Launch to finish the setup. I did not create Status Check Alarms, I will go back when the server is in production.
  • In My Resources, click the Refresh button to see your new instance.
  • Click running instances to see the list of instance.
  • Now to manage the server. Select the instance (put check to select the instance). In Instance Actions, select Connect, this will give you option to connect e.g. Connect with a standalone SSH Client and Connect from your browser using the Java SSH Client (Java Required).
  • I like Putty SSH tool, so obviously I choose Connect with a stand alone SSH client.
  • You need to download the PuTTYgen to convert your private key. Here's a procedure provided by Amazon.
  • Let's get an Elastic IP address for the server. In AWS console dashboard, click Elastic IPs, click on Allocate New Address, click Yes, Allocate
  • In Addresses, put check on the IP address, then click Associate Address. In Select an instance, choose the instance to associate your IP, click Yes Associate. It will shows in your list of Addresses, IP Address point to your Public DNS. 
For example: 184.x.x.x associated to
  • Now go to your domain name registrar e.g., Enom, or GoDaddy. Add A record IP Address to your domain.
  • After that, let's begin managing our instance (cloud server). If everything is correctly configured with your PuTTY setup, you should be using your user name (ec2-user) to login, and yes no password required because of your private key.
Now we're connected to the first instance. Let's do update, very important run the following command.
[[email protected] ~]$ sudo yum update [Enter]
The script will run for about 2-5 minutes depending your Internet bandwidth speed.

[[email protected] ~]$ sudo su [Enter]

After you execute sudo su, you're now in super user mode.
[root@ip-information-here ~]$

We have the server but we have nothing configure yet, so let's install Apache Web Server.
[root@ip-information-here ~]$ yum install httpd
Start the service
[root@ip-information-here ~]$ service httpd start
Configure to start httpd service automatically

[root@ip-information-here ~]$ chkconfig httpd on

How about installing PHP? Let install PHP
[root@ip-information-here ~]$ yum install php php-mysql

Restart the Apache web server to introduce PHP
[root@ip-information-here ~]$ service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

And install MySQL database to hold our data.
[root@ip-information-here ~]$ yum install mysql-server

Start MySQL service:
[root@ip-information-here ~]$ service mysqld start

Similar to httpd, we need to start MySQL service automatically:
[root@ip-information-here ~]$ chkconfig mysqld on

Create your first database:
[root@ip-information-here ~]$ mysqladmin -uroot create friended
where friended is the database name

Let us secure our database:
[root@ip-information-here ~]$ mysql_secure_installation
Enter the root current password.
Change root password, and confirm.
Remove anonymous user: Y
Disallow root login remotely: Y
Remove test database and access to it: Y
Reload privilege tables now: Y 

I want to install my wordpress in my root directory e.g. /var/www/html.

Check your current directory:
[root@ip-information-here ~]$ pwd

Change directory to /var/www/
[root@ip-information-here ~]$ cd /var/www

Download the latest copy of Wordpress:
[root@ip-information-here ~]$ wget

Extract WordPress:
[root@ip-information-here ~]$ tar -xzvf latest.tar.gz

Move the wordpress directory to the html folder.ec2
[root@ip-information-here ~]$ rmdir html
[root@ip-information-here ~]$ mv wordpress html

Delete the latest.tar.gz copy to clean our install.
[root@ip-information-here ~]$ rm latest.tar.gz

Now, configure the Wordpress install
Change directory to html
[root@ip-information-here ~]$ cd html

[root@ip-information-here ~]$ mv wp-config-sample.php wp-config.php
Edit wp-config.php with your database connection credentials e.g. db name, username, and password.
[root@ip-information-here ~]$ vi wp-config.php

define(‘DB_USER’, ‘root’);
define(‘DB_HOST’, ‘localhost’);

Press ESC, type :wq to save.

Configure your wordpress.

It's easier if you have an FTP Server, let's go ahead and install one for our server.
[root@ip-information-here ~]$ yum install vsftpd


Step-by-step installation of phpMyAdmin to Amazon EC2:


Popular posts from this blog

Frequent Account Lockout in Active Directory

I have a user in Windows Pro 7, and Windows Server 2003 environment that is frequently account locked out. I tried many different scenarios to resolve this account lockout issue, from resetting his password, changing a new password, remove and re-join the domain, rebooting the workstation and active directory servers.

I tried to use the command prompt utility to run "rundll32.exe keymgrdll, KRShowKeyMgr" (case sensitive) to delete the account in Windows 7 password cache, and still no luck.

Still searching for answer ... Let me know if you encounter a similar issue in Windows Pro 7 and Windows Server 2003.

Continue reading updated post here:

Alternative Social Networks

If you are planning to create your social network e.g. similar to Facebook. Here's a short list of alternative software's:

Open Source and Free​ - Wordpress (Open Source and Free) - (Open Source and Free)Commercial Social Networks software ($299 Stand Alone, $29/mo Cloud) (run with Joomla, need to know CMS) (very expensive, $399 for Standard) (from free to Commercial, I left my networks and they are selling it (I used this before, it's hard to maintain. I moved to NING but left too after it was sold to another company) (I don't recommend using this service, it's hard to export your data when it's time to move)Something to check when selecting your next soc…

Example of Out of Office Reply for Terminated Employee

This is a sample message that I used for terminated employees, unless HR staff specified a different message.
=== Example for KING.NET Employee === John Doe (employee or consultant) is no longer with KING.NET effective June 1, 2008 (termination date). For matters relating to "Project Name here" please direct your concerns to John Smith at [email protected] (Manager or Supervisor). For all other matters, please direct your email to Mary Smith HR at [email protected]
Please call our main office 703-345-6789 if you have other concerns.
Thank you.
=== end of message ===