Amazon EC2 server setup guide

Posted
Categorized as Apps, Software Tagged , , , , ,

Here’s a guide which help me setup an AWS  (Amazon Web Services) EC2 server for one of my clients. I used to use their free S3 CND service a few years back; though the process has changed a bit since then; so without further flim-flam.

We’ll be needing PuTTY and FileZilla FTP client for this endeavor. Once you’ve got that sorted, login into your AWS console and proceed to the EC2 link under the Service tab. Once there click launch instance, this will launch a wizard which assist you in creating your machine.

image

Select the Amazon Linux AMI (Amazon Machine Image)

image

Click on the next steps selecting the defaults until you reach the Security Groups section; once there add the HTTP and HTTPS rules.

image

After which you will asked to review your settings and prompted to import or add a key pair. Create a new one and save it somewhere safe. Without the key, you will not be able to access the machine, you will not be able to add a new one too.

image

Download the Key Pair then launch the instance. The instance will take 5-10 minutes to initialize; during that time, process to Network and Security > Elastic IP’s and click Allocate New Address. When the new IP is created, take note of it then right click on the IP and select Associate Address, then select the instance you just made.

image

When this is done, your machine is not up and running. You can now connect to this virtual machine via PuTTY and Filezilla.

Open Filezilla, on the File menu bar, click on Edit > Settings, then go to SFTP then click Add File. Locate and add the key pair file (.pem) file you downloaded earlier. You will be prompted to convert the .pem file to a .ppk.file, click yes and save that file too.

image

Now connect via FTP by putting the Elastic IP you created earlier as the host, SFTP as the protocol and ec2-user as the username; this is the default. Leave the password blank. If everything goes well you should be able to connect without any issues.

image

Now open up PuTTY, use the same IP as the host and connect via SSH. Under Connection > SSH > Auth: Click add file then select the .ppk file created by Filezilla earlier from the original .pem file, then click Open.

image

Login as the ec2-user and hit enter. If everything worked out, you now have root access to the machine.

image

From here you can proceed to install and setup the services you need to run a your web server. Below is a quick cheat sheet I used to get mine running.

–update the server
sudo yum update

–login as super user
sudo su

–install apache
yum install httpd

–start apache
service httpd start

–install php
yum install php php-mysql

–install mysql
yum install mysql-server

–start mysql
server mysqld start

–setup mysql, leave root password blank as default, enter new password then select Y on all questions
mysql_secure_installation

–set html folder permission
chmod -R 775 /var/www/html
chown -R ec2-user /var/www/html

Leave a Reply