Installing & Setting Up PostgreSQL With PostGISLast updated January 26th, 2010 at 02:40pm Introduction
This tutorial will guide you through the steps involved with installing PostgreSQL and PostGIS on your Windows based PC. PostGIS is a requirement for the way GPSFileDepot creates Garmin compatible maps.
Instructions
This tutorial last updated for version 8.4.
PostgreSQL
- Go the the PostgreSQL binary server.
- Scroll down and find the largest number, click that one.
- Click "win32"
- Download postgresql-X.X.X-X.zip. Where the X are the most recent version information. Make sure you are getting at least version 8.3+.
- Select one of the mirrors and download via http or ftp.
- Save the zip file.
- Extract everything in the zip file to a folder.
- Double click "postgresql-X.X.msi"
- Select your language and hit start.
- The normal settings should be good. Make sure you will have the Application Stack Builder installed. Also, it is good to make sure pgAdmin III is installed.

- Make sure the "Install As Service" box is checked.
- If a box pops up asking to create an account click Yes.
- Leave the next page alone; just make sure the initialize database cluster box is checked and enter a password.
- Click Next to leave procedural languages alone.
- Check any other modules you may need but most likely the default (Adminpack.) is just fine.
- Click Next to complete the installation.
- Make sure the "Launch Stack Builder" box is unchecked and click finish.
- Now we will make it so you can connect without a password (this is optional but makes life easier)
- Stop the service from running: (start>all programs> postgresql X.X>Stop Service)
- Open pg_hba.conf (start>all programs>postgresql X.X>Configurations Files>Edit pg_hba.conf
Note: In v 8.4+ you have to access the pg_hba.conf by browsing to the PostgreSQL folder, then version number, then data and then open pg_hba.conf
- Change the line reading:
host all all 127.0.0.1/32 md5
to
host all all 127.0.0.1/32 trust
If you use IPv6 change the next line below it as well.
- Reload the configuration files (start>all programs>postgresql X.X>Reload configuration)
- Start the service (start>all programs>postgresql X.X>Start Service)
PostGIS
- Start the Application Stack Builder (in PostgreSQL's start menu)
- Now that the Application Stack Builder has launched you can install PostGIS.
Note: If it didn't launch go to Start>All Programs>PostgreSQL X.X and click Application Stack Builder. This is also how you can update PostGIS when new versions are released.
- Select your local server:

- Under "Spatial Extensions" check the most recent version of PostGIS:

- Pick a server near you and click "Next"
- Leave the download location alone and click "Next"
- After the download finishes click next to start installing.
- Make sure create spatial database is checked.
- Leave the default options. Make sure you enter your password if needed.
Now you should have a fully operational postgis database.
Creating More Databases
You may, at some point, need to create more postGIS databases. In this case you need to create them with a template file.
- Open pgAdmin III
- Connect to your local server
- Right click on databases and click "New Database..."
- Enter a name for your new database
- Select the username you've been using as the owner (default is "postgres")
- For the template select "template_postgis"

- Click okay.
A new database has now been created. You have to use a template in order to have it be a spatial database.
If you have any questions about this tutorial please contact us or post in the forums. |