Tutorial: How to install wordpress on AWS EC2 t2.micro instance ? Charpter-2

Charpter 2: How to install a LAMP Web Server on Amazon Linux

Now, we will install Apache + MySQL + PHP on AWS EC2 t2.micro AMI.

(Clicker here to see Charpter 1: how to install AWS EC2 t2.micro AMI)

1.Connect to AWS EC2 t2.micro AMI Using PuTTY

(a) Download & Install PuTTY on windows

Download URL: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

(b) After installing PuTTY successfully, start PuTTYGen to generate key file.

Under Type of key to generate, select SSH-2 RSA

Type of key to generate
Type of key to generate

(c) Click Load. By default, PuTTYgen displays only files with the extension .ppk. To locate your .pem file, select the option to display files of all types.

PS: How to generate .pem file?

In previous tutorial‘s step 7. Review Instance Launch, you have downloaded a .pem file after launching the instance.

Or you can create a new .pem file as below steps:

(1) Sign in to AWS and open the Amazon EC2 console.

(2) From the navigation bar, select a region which your AMI located for the key pair.

           Select EC2 Region

(3) Click NETWORK & SECURITY > Key Pairs in the left navigation pane.

(4) Click Create Key Pair button.

(5) Enter a new key pair name in the Key pair name field of the Create Key Pair dialog box, and then click Create.

(6) The private key file is automatically downloaded by your browser. The base file name is the name you specified as the name of your key pair, and the file name extension is .pem. Save the private key file in a safe place.

(d) Select the private key .pem file that you created in the previous step and click Open. Click OK.

(e) Click Save private key. PuTTYgen displays a warning about saving the key without a passphrase. Click Yes.

(f) Specify the same name for the key that you used for the key pair. PuTTY automatically adds the .ppk file extension.

(g) Start PuTTY

Config PuTTY Session

  • Select Session and input the following fields:

(i) In the Host Name box, enter [email protected]_dns_name.

You can find your public_dns_name from Amazon EC2 consoleInstance Public DNS

(ii) Under Connection type, select SSH.

(iii) Ensure that Port is 22.

  •  Next select Connection, expand SSH, and then select Auth. Complete the following:

(i) Click Browse.

(ii) Select the .ppk file that you generated for your key pair, and then click Open.

(iii) Click Open to start the PuTTY session.

Select auth ppk file
Select auth ppk file

 (iv) If this is the first time you have connected to this instance, PuTTY displays a security alert dialog box that asks whether you trust the host you are connecting to. Click Yes. A window opens and you are connected to your instance.

2. Install “Web Server”, “MySQL Database” and “PHP Support”

(a) To update all software packages

(b) install the Apache web server, MySQL, and PHP software packages

After installation finish, you can check it like below:

(c) Install the php-mysql package

(d) Start web server

(e) Set apache to  start at each system boot.

Check the configure:

Then open the web browser to test http://your_instance_public_ip


Next Charpter: How to install wordpress on AWS EC2 t2.micro instance



Leave a Reply

Your email address will not be published. Required fields are marked *