Changes between Initial Version and Version 1 of UsersWikiPostGIS21UbuntuPGSQL93Apt


Ignore:
Timestamp:
12/09/13 14:56:53 (11 years ago)
Author:
mapbaker
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UsersWikiPostGIS21UbuntuPGSQL93Apt

    v1 v1  
     1The [http://wiki.postgresql.org/wiki/Apt PostgreSQL Apt Repository] now hosts installs of PostGIS, in addition to Postgresql and PGAdmin3.
     2
     3The following describes how to install Postgresql 9.3, PostGIS 2.1, PGAdmin 1.18.1 and shp2pgsql-gui on Ubuntu versions 12.04 through 13.10.
     4
     5== Add Respository to sources.list ==
     6
     7Run in terminal:
     8
     9{{{sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list'}}}
     10
     11{{{wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -}}}
     12
     13{{{sudo apt-get update}}}
     14
     15== Install ==
     16The following will install postgresql 9.3, PostGIS, PGAdmin3, and additional supplied modules including {{{adminpack}}}
     17
     18{{{sudo apt-get install postgresql-9.3-postgis pgadmin3 postgresql-contrib}}}
     19
     20== Enable Adminpack ==
     21
     22While in terminal, log in to psql as postgres user:
     23
     24{{{sudo -u postgres psql}}}
     25
     26{{{CREATE EXTENSION adminpack;}}}
     27
     28Quit psql:
     29
     30{{{\q}}}
     31
     32== Create new PGSQL user ==
     33
     34You can create a new database super user to use instead of the default {{{postgres}}} user.
     35
     36While in terminal, run:
     37
     38{{{sudo su - postgres}}}
     39
     40{{{createuser -d -E -i -l -P -r -s yourUserName}}} (be sure to change the username to your desired username)
     41
     42Enter your new password when prompted
     43
     44Log out as {{{postgres}}} user:
     45
     46{{{exit}}}
     47
     48Exit terminal:
     49
     50{{{exit}}}
     51
     52== Use PGAdmin to log into database server ==
     53
     54From the Ubuntu launcher, type in PGAdmin to reveal the application
     55
     56Fill in the necessary credentials to log in:
     57
     58{{{
     59- Name: nickname you want to give your connection
     60- host: localhost (until you change the connection settings)
     61- port: 5432 by default
     62- maintenance DB: postgres by default
     63- username: whatever you chose in the step above
     64- password: whatever you chose in the step above
     65}}}
     66
     67== Enable postgis extensions on new database ==
     68
     69Since you installed PostgreSQL and PostGIS from the PostgreSQL apt repository, you now have all the extensions for PostgreSQL, including PostGIS
     70
     71Expand the database tree in PGAdmin, and reveal the extensions node
     72
     73Right-click the extensions node, and click {{{new extension}}}
     74
     75Enable the {{{postgis}}} extension, as well as {{{postgis_topology}}}
     76
     77== Test shp2pgsql-gui ==
     78
     79Another handy piece of software to use is the {{{shp2pgsql-gui}}} tool. This will allow you to quickly connect to your new PostGIS database and import a Shapefile.
     80
     81Open terminal, and type:
     82
     83{{{shp2pgsql-gui}}}
     84
     85Follow the on-screen prompts to load your data.
     86
     87For more information, visit the [http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_tut01 Boston GIS] tutorial in the section "Load Towns Data"
     88
     89