Launch Ubuntu, install and configure Apache

Home

Server Set Up

An account with AWS is required which currently is free for the first six months. If a paid account is used the costs incurred for experimenting with the launch of a server is very low so long as any servers created are stopped when not being actively used. In fact it is a good strategy to launch several Ubuntu or other operating systems in order to become familiar with the process.

Having set up an account with AWS, you are encouraged to create an Identity Access Management (IAM) user with limited but suffienet priveleges for the task(s) you intend to carry out. Then you can log in as an IAM user instead of as a root user. This is particularly useful if more than one person is using the account. However, you can sign in as the root user which means you can skip IAM.

Launch Instance

Browse to Server using IPv4 address

If the Bash script was included when launching the server then Apache will now be installed and it’s default web page will be accessible. Navigate to Instances and copy the public IPv4 address and paste it into the address bar of a browser. If this leads to an error page click on the address and change the protocol from https to http and try again. You should see the Apache default web page which has some useful information about setting up and using Apache.

Connect to Instance using SSH

You can now access the command line of the instance remotely from your computer using SSH. This will require the .pem file saved during the server launch. If using a local Linux computer then the permissions of the file should be set to r——– which is achieved with the command:


chmod 400 ~/.ssh/ec2private.pem

Now run the following command on your local computer:


ssh -i "path/to/your-key-pair-file.pem" ubuntu@<Public DNS>

The name of your .pem file and the path to it from your current working directory should be known to you. The user ubuntu will have been set up automatically at launch. The Public DNS is obtainable from the AWS Instances page if the instance under consideration is selected.

Running this command will change the prompt to the ubuntu user on the server and any commands entered will now run on that server.

If a Bash script was not supplied as user data during the launch the commands to install and configure Apache can be issued. The Bash script can be used as a guide for doing this. The Bash script would be run as the root user. The ubuntu user will need to preface most of the commands with sudo which enables them to be run as if the user were root.