Step 1: Create an AWS Account
First of all you need to login to your AWS account , if you don’t have one then create one now from here .
AWS offer’s one year Free Tiew , mean’s you can host your small website for free on a dedicated server 🙂 .
Step 2: Create an Instance
Before Creating a New Instance you need to think about your website , for a normal website free tier config will be fine other wise you need to go for m1.small or up
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 32-bit Amazon Linux AMI.
- Instance details: Select the Instance Type you want to use. i’m going for t2.micro .
- In Next Step Leave as it is 🙂 .
- IN STEP 4 :- STROAGE SETTING’S , CHANGE FROM 8GB TO 30GB (TILL 30GB IT’S FREE 🙂
- IN STEP 5:- TAG’S (LEAVE IT AS IT IS )
- IN SETP 6 :- SECURITY GROUPS ( OPEN ALL THE HTTP , HTTPS FOR ANY WHERE ).
- IN NEXT STEP :_ Check each and every thing and click on launch .
- Create a new key pair. Enter a name for your key pair . (you can choose any name but keep this file safe )
- Select the quick start security group.
- Launch your instance.
- Click on left side menu on Elastic IP under Network and security .
- Create a new IP address and associate it with your running instance .
Now you have to access your server using SSH . Windows’s user’s need to download putty and MAC user’s can use there terminal .
If you are going to use putty then convert your pem file to ppk using puttygen .
Step 3: Installing the Apache Web Server
type :- sudo su
To install the Apache Web Server, type:
yum install httpd
Start the Apache Web Server:
service httpd start
Try Testing Your Website using your Public DNA or your elastic Ip address . http://ec2-**-**-***.compute-1.amazonaws.com
Step 4: Install PHP
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:
- Type i to start the insert mode
- Type <?php phpinfo() ?>
- now press Esc button to exit the insert mode .
- Type :wq to write the file and quit vi
Open a browser and access test.php to test your PHP installation: http://ec2-**-**-**-***.compute-1.amazonaws.com/test.php (Use your actual public DNS name).
Step 5: Install MySQL
To install MySQL, type:
yum install mysql-server
service mysqld start
Create your “wordpressblog” database:
mysqladmin -uroot create wordpressblog
Secure your database:
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
Step 6: Install WordPress
To install WordPress, type:
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”:
mv wordpress blog
Create the WordPress wp-config.php file:
mv wp-config-sample.php wp-config.php
chmod 777 wp-config.php
Open You Public DNS or your elastic IP address and config your WordPress .
After successful install don’t forget to change your file permission
chmod 440 wp-config.php
Step 7: Map your Domain Name
you can even use your public DNS or elastic IP , but if you want to use your domain name then , follow these step’s :-
- Login to your domain access where you can manage your DNS .(KEEP THE DEFAULT NAME SERVER’S )
- Add a new A record or cname record .
- if you are going to add A record then use your elastic Ip as a host . example @ 1200 your elastic IP
- if you are adding cname then use your public DNS as a host
@ 1200 ec2-**-**-**-***.compute-1.amazonaws.com
Woo!! your WordPress Install in AWS is ready :). Enjoy 🙂