
What type of EC2 instance should you use? I started my experiments with a Micro instance[t2 micro] as its available for free tier. EC2 is a computing instance where you will be charged for computing instance in hours.
To create a new instance, access the AWS Management Console and click the EC2 tab:
Once your instance is running, you can ssh into it. First, you need to identify the address of your instance: Select the instance in the AWS Management Console, and look for the Public DNS in the instance description (bottom part of the screen).
Use that address (and a path to your .pem file) to ssh into your instance:
ssh ec2-user@ec2-54-29-192-76.compute-1.amazonaws.com -i ~/vtmkey.pem
If you get a message about your .pem file permissions being too open, chmod your .pem file as follows:
chmod 600 ~/vtmkey.pem
Many of the shell commands below require root access. To avoid having to prefix these commands with sudo, let’s just switch user once and for all:
sudo su
To install the Apache Web Server, type:
yum install httpd
Start the Apache Web Server:
service httpd start
To test your Web Server, open a browser and give url like : http://ec2-54-29-192-76.compute-1.amazonaws.com (Use your actual public DNS name). You will get apache page.
To install PHP, type:
yum install php php-mysql
Restart the Apache Web Server:
service httpd restart
Create a page to test your PHP installation:
cd /var/www/html
vi test.php
Open a browser and access test.php to test your PHP installation: http://ec2-54-29-192-76.compute-1.amazonaws.com/test.php (Use your actual public DNS name).
To install MySQL, type:
yum install mysql-server
Start MySQL:
service mysqld start
Create your “blog” database:
mysqladmin -uroot create blog
Secure your database:
mysql_secure_Installation
Answer the wizard questions as follows:
To install WordPress, type:
cd /var/www/html
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gzcd
This will uncompress WordPress in its own “wordpress” directory. I like having WordPress in a separate directory, but would rather rename it to “blog”:
mv wordpress blog
Create the WordPress wp-config.php file:
cd blog
mv wp-config-sample.php wp-config.php
vi wp-config.php
Open a Browser and access your blog: http://ec2-54-29-192-76.compute-1.amazonaws.com/blog (Use your actual public DNS name). This should trigger the WordPress configuration process.
To use your blog in production, you will have to:
To associate an IP address to your instance:
To map your domain name to your IP address, you will have to use the tools provided by your domain registrar. If you use Namespark.in , specify ns1.namespark.in and http://ns2.namespark.in as the name servers for your domain, and use the DNS Manager to modify the A record and point to your IP address. Documentation is available here.
Once everything is configured and mapped correctly, access the General Settings in the WordPress management console and make sure the WordPress Address and Site Address are specified correctly using your domain name as in the screenshot below.