-
Notifications
You must be signed in to change notification settings - Fork 50
Installing open geo software from source: ubuntu edition
(back to general Software section). Switch to the Mac version »
Assumes EC2 but run with it!
#Setting Up Ubuntu 11.10 (Oneiric) EC2 Instance
-
Log in at console.aws.amazon.com
-
Go to alestic.com and choose Ubuntu 11.10 Oneiric EBS boot (us-east-1)
-
Choose instance type Medium and availability zone us-east-1d (or nearest you).
-
Choose your keypair.
-
Create a security group called custom_name.
- We have opened ports 80, 22, 443, and 8133.
-
Launch your instance
#Configure The EC2 Instance
-
Log into the server with
ssh -i /path/to/keypair ubuntu@<public-dns>
-
sudo apt-get update
-
sudo apt-get upgrade --fix-missing
-
sudo apt-get install git --fix-missing
sudo apt-get install -y build-essential python-software-properties software-properties-common
sudo add-apt-repository -y ppa:ubuntugis/ppa && sudo apt-get update
sudo apt-get install -y gdal-bin
You'll also likely want to install the python bindings for gdal and ogr:
sudo apt-get install -y python-gdal
sudo add-apt-repository -y ppa:mapnik/v2.1.0 && sudo apt-get update
sudo apt-get install -y libmapnik
If you have large shapefiles (SHP) you'll also want to run shapeindex on them to significantly speed up map rendering:
sudo apt-get install mapnik-utils
sudo add-apt-repository -y ppa:mapnik/nightly-trunk && sudo apt-get update
sudo apt-get install -y libmapnik
sudo apt-get install -y python-dev python-pip
sudo apt-get install -y python-cssutils python-imaging gunicorn python-mapnik
sudo apt-get install -y python-psycopg2 python-shapely
sudo pip install tilestache
sudo pip install cascadenik
Gotcha: If you later upgrade tilestache, it'll bork python-imaging (PIL). To fix:
sudo pip uninstall PIL
Most basic operations (and a some super complex!) can be undertaken in Python using Shapely.
sudo apt-get install python-shapely
When OGR is better, but is ugly. A better python interface for OGR (see above).
sudo apt-get install libgdal-dev
sudo pip install Fiona
sudo apt-get install -y osm2pgsql
sudo apt-get install -y postgresql postgresql-contrib-9.1 postgresql-server-dev-9.1 postgresql-9.1-postgis
Make yourself a privileged user:
-
sudo -u postgres createuser -s -d -r $USER
-
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
Confirm the following settings by editing 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 replication privilege.
Then restart Postgres so that takes effect, if necessary:
sudo /etc/init.d/postgresql restart
-
Making Postgres fast
The defaults live in 1990s land. Upgrade your computer's gray matter!
- Give Postgres more system memory, lots! - More is better here, set to the total RAM on your machine.
- PGTune: Postgres config file: set the shared ram for each worker to ~2 to 4 gigs, depending on your setup. More (4 gb) is better unless you're running multiple concurrent sessions and need to play nice (2 gb).
-
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/