Monday, August 8, 2011

Spatial Wiki 3 - Server Setup

Following up on our Spatial Wiki Objectives and a bit of Research the first thing we're going to do is setup an Amazon EC2 server to host the wiki.  There are lots of on-line tutorials on setting up an Amazon EC2 instance so I'll focus on the particulars of getting an Ubuntu server setup specifically for our purposes.

To setup a new server start by signing into the AWS Management Console, then goto the EC2 tab and select the region to setup the server in.  Use the Launch Instance to button to create a new instance.  For the tutorial we're going to use Ubuntu 10.04 LTS Lucid Lynx, and an official Canonical AMI.  When you launch the instance goto the "Community AMIs" and search for the appropriate AMI for your region from the list of official AMIs.  In this case I am using an AMI tagged ami-89c694cc that is a 64bit image in the US West region.

Once started the Launch Instance wizard will guide you through setting up user data, a key pair, and a security group.  You don't need to supply any user data, but you'll want to give the server a descriptive name, create a key pair (essential for logging into the server), and create a new security group.  In this example I've named the server "FOSS4G Spatial Wiki 1", created a key pair spatialwiki.pem which I downloaded, and created a security group called spatialwiki ... overall not too creative with names.

When setting up the security group you want to open up the following ports for inbound traffic:
  • 22 for SSH
  • 80 for HTTP
  • 5432 for PostgreSQL remote accesss
  • 8080 for Tomcat
Once the instance is launched it should look something like this in the AWS Management Console:








It's not required, but I like to create an Elastic IP address to associate with the server.  To do this select the Elastic IPs menu option in the management console and use the buttons to create a new Elastic IP and associate it with the server.  The Elastic IP is somewhat more permanent than the server's IP and can be linked to a different back-end server if/when you need to replace the server.

See also the Ubuntu EC2 Starters Guide

To login to the server use SSH from Linux or Mac, or PuTTY or equivalent from a Windows computer. From the AWS Management Console if you highlight the instance and do "Instance Actions" and "Connect To" it will show details on how to connect.  Typically too you have to protect the key file before connecting so I've done something like this from a Mac terminal window:

chmod 400 spatialwiki.pem
ssh -i spatialwiki.pem ubuntu@ec2-50-18-115-52.us-west-1.compute.amazonaws.com

With this you are connecting specifically as the user ubuntu via the identity file spatialwiki.pem.

Once connected to the server we'll get the first set of software installed using the setup tools on the new server.  The details will be listed, but specifically do the following when logged into the new server:

sudo apt-get update
sudo tasksel --section server

The first command updates the list of available software and the second command launches an application that allows you to select additional packages to install. The packages that are already installed are ticked with asterisks. Highlight and install the following additional packages:
  • LAMP server (specifically includes Apache, MySQL and PHP)
  • PostgreSQL database
Click OK to install the packages.  The installation should run smoothly and you will be prompted to enter a root password for MySQL.

Once the software is installed you will have a fully functional basic web server that will have a default webpage that you should be able to view from anywhere using the IP address of the EC2 server you created, for example http://[Your Server IP], and it will look like this:








If it doesn't work ... some good things to try/check are:
  • The security group on the server (in the AWS Management Console) needs to allow inbound port 80 traffic.
  • Be sure your firewall and/or proxy isn't blocking access to a generic IP based server.
  • Reboot the server via the AWS Management Console to make sure the web server started properly.
The next step is to Install MediaWiki.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home