Creating account on AWS and Setup WordPress on it

Amazon Web Services, a subsidiary of Amazon.com, offers a suite of cloud-computing services that make up an on-demand computing platform. AWS offers reliable, scalable, and inexpensive cloud computing services. Free to join, pay only for what you use.

Create Free Account

First we need to create AWS account. Click on Amazon EC2 to start with Amazon Elastic Compute Cloud (Amazon EC2). You’ll have to provide  a credit card and a phone number where you will be called as part of the online registration process for verification purposes.  Amazon offers a AWS Free Tier,enables you to gain free, hands-on experience AWS.

Setup EC2 Instance

Amazon EC2 provides a wide selection of instance types optimized to fit different use cases. Instance types comprise varying combinations of CPU, memory, storage, and networking capacity and give you the flexibility to choose the appropriate mix of resources for your applications. Each instance type includes one or more instance sizes, allowing you to scale your resources to the requirements of your target workload.  You can get more details about the Amazon EC2 Instance Types from Amazon website.
  • To create a new instance, access the AWS Management Console and click the EC2 tab
  • Choose an AMI in the classic instance wizard: I chose the Basic 64-bit Amazon Linux AMI.
  • Instance details: Select the Instance Type you want to use. I chose Medium (m3.medium).
  • Create a new key pair. Enter a name for your key pair and download your key pair (i.e. .name.pem).
  • Select the quick start security group.
  • Launch your instance.

SSH into your Instance

When your instance is online ,you can ssh to into it using the key pair generated and the the you will get the public DNS for your instance using the Amazon EC2 console. Switch to root and proceed with the installation of other softwares. You can switch to root using the following command.

$ sudo su -

Install Web Server

 To install and start the the Apache Web Server on a Centos server using the following commands:
$ yum install httpd
$ service httpd start
You can test your web server by, open a browser and access your web site: http://instance.com-amazon.com (Use your actual public DNS name)

Install PHP and MysQL

 You can install PHP and other reuqired modules using the yum command, here I am mentioning php and php-mysql, basic installation for loading php files and connecting to mysql. In latest php versions php-mysql is deprecated, so either use mysqli or pdo_mysql extension. Once the modules are installed, restart web server to load the new installations.
$ yum install php mysql-server php-mysql
$ service mysqld start
$ service httpd restart
 You can test the php installation by adding a php info page under the document root of the apache web server and load it using your public dns name or using the public ip address.  Create a file phpinfo.php in document root with the following content.
<?php
phpinfo(); 
?>
Open a browser and access phpinfo.php to test your php installation:
 http://instance.com-amazon.com/phpinfo.php
(Use your actual public DNS name).
Next step is create database for the wordpress blog.
  • Login into mysql
$ mysql -u mysql_user -p
Enter password:
  • Create database
mysql > create database db_name;
  • Verify the database
mysql > show databases;
  • Create the database user
mysql > create user db_user;
  • Grant privileges while assigning the password
mysql > grant all on db_name.* to 'db_user'@'localhost' identified by 'db_password';

Secure your database

$ mysql_secure_Installation
Answer the wizard questions as follows:
Enter current password for root: Press return for none
Change Root Password: Y
New Password: Enter your new password
Remove anonymous user: Y
Disallow root login remotely: Y
Remove test database and access to it: Y
Reload privilege tables now: Y

 Install WordPress

 You can download the latest tar archive for the wordpress from the wordpress site and uncompress it into the document root of the server ( where we need the wordpress installation ).
$ cd /var/www/html
$ wget http://wordpress.org/latest.tar.gz
$ tar -xzvf latest.tar.gz
This will uncompress WordPress in its own “wordpress” directory. I like having WordPress in a separate directory, but would rather rename it to “blog or anything you  like”:
 # mv wordpress blog
 Create the WordPress wp-config.php file:
$  cd blog
$  mv wp-config-sample.php wp-config.php
Edit wp-config.php file and update the database connection parameters like database name, database user and database password.
define('DB_NAME', 'db_name');
define('DB_USER', 'db_user');
define('DB_PASSWORD', 'db_password');
define('DB_HOST', 'localhost');
Use the database details you have created. Please use separate database credentials for separate installations. Also do not use root mysql login for the wordpress installation.
Open a Browser and access your
blog: http://instance.com-amazon.com/blog (Use your actual public DNS name).
This should trigger the WordPress configuration process. Follow the instructions to complete the wordpress installation.
You can add virtual host configuration for your domain in the apache configuration and install wordpress under the domain. I am not referring it here, because this is just a basic instruction for creating an AWS instance.

AWS Server Management

If you need “AWS Server Management”, you can contact us for “Server Management” and will help you in managing the server for you.
Facebook Comments