Skip to content

Setting up an ec2 ubuntu map server

kaleb edited this page Oct 27, 2012 · 11 revisions

SETTING UP UBUNTU 11.10 (Oneiric) EC2 INSTANCE

  1. Log in at console.aws.amazon.com

  2. Go to alestic.com and choose Ubuntu 11.10 Oneiric EBS boot (us-east-1)

  3. Choose instance type Medium and availability zone us-east-1d.

  4. Choose your keypair.

  5. Create a security group called [clientname]. Open ports: 80, 22, 443, and 8133.

  6. Launch your instance

CONFIGURE THE EC2 INSTANCE

  1. Log into the server with:

     ssh -i your-keypair-full-path ubuntu@public-dns
    
  2. sudo apt-get update

  3. sudo apt-get upgrade --fix-missing

  4. sudo apt-get install git --fix-missing

  5. Get package tools

    sudo apt-get install python-pip
    

INSTALLING MAPNIK

  1. sudo apt-get update

  2. Go to https://github.com/mapnik/mapnik/wiki/UbuntuInstallation

    To install the stable version of Mapnik 2.x:
    sudo add-apt-repository ppa:mapnik/nightly-2.1
    sudo apt-get update
    sudo apt-get install libmapnik mapnik-utils python-mapnik
    
  3. Get TileStache set up:

    sudo easy_install -U gunicorn
    sudo apt-get install python-imaging
    sudo pip install -U modestmaps
    sudo pip install -U tilestache
    sudo pip install -U cssutils
    sudo pip install -U cascadenik
    sudo apt-get install python-psycopg2 python-shapely
    

INSTALLING AND SETTING UP A POSTGIS-ENABLED POSTGRES DATABASE

  1. sudo apt-get install postgresql-9.1 postgresql-server-dev-9.1 postgresql-contrib-9.1 postgresql-9.1-postgis

  2. CONFIGURE THE POSTGRES DATABASE:

    Test you can log in to the database with:

    sudo -u postgres psql
    

    Background reading: https://help.ubuntu.com/11.10/serverguide/C/postgresql.html

    Edit the access permissions (or pico)

    sudo vim /etc/postgresql/9.1/main/pg_hba.conf
    

    Made this section all have trust at the line ends:

        # Database administrative login by Unix domain socket
        local   all             postgres                                trust
        
        # TYPE  DATABASE        USER            ADDRESS                 METHOD
        
        # "local" is for Unix domain socket connections only
        local   all             all                                     trust
        # IPv4 local connections:
        host    all             all             127.0.0.1/32            trust
        # IPv6 local connections:
        host    all             all             ::1/128                 trust
        # Allow replication connections from localhost, by a user with the
    

    Then restart Postgrest so that takes effect:

    sudo /etc/init.d/postgresql restart
    
  3. Set up your PostGIS template

    Read: https://github.com/nvkelso/geo-how-to/wiki/PostGIS

    Alternatively: http://wygoda.net/blog/postgis-template-database-ubuntu-1110/

VIEW ON THE INTERNETS!

  1. sudo apt-get install apache2-mpm-prefork

  2. sudo a2enmod userdir

    Note: "a2enmod" == "apache2 enable module"

  3. Make sure you have a public_html dir inside your usr dir.

Clone this wiki locally