Skip to content

Instantly share code, notes, and snippets.

@clzola
Created September 1, 2016 11:05
Show Gist options
  • Save clzola/8184821f146b18e1120437abaea331db to your computer and use it in GitHub Desktop.
Save clzola/8184821f146b18e1120437abaea331db to your computer and use it in GitHub Desktop.
How to install PostgreSQL + PostGIS
# Install Postgresql
sudo apt-get install -y postgresql postgresql-contrib
# Create a database and a user to access it
# this will prompt you for a database password
sudo -u postgres createuser -P USER_NAME_HERE
sudo -u postgres createdb -O USER_NAME_HERE DATABASE_NAME_HERE
# Test connecting to Postgresql
psql -h localhost -U USER_NAME_HERE DATABASE_NAME_HERE
# Add PostGIS support to the database
sudo apt-get install -y postgis postgresql-9.3-postgis-2.1
sudo -u postgres psql -c "CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology;" DATABASE_NAME_HERE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment