Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am working on Ubuntu Precise with postgresql version 9.3 and postgis 2.0.

After initially starting my postgres database and eventually getting permission errors that would prevent postgres from starting due to my modifying the pg_hba.conf file I followed a tutorial from ArchLinux ArchLinux postgres setupwhich stated to create a directory to house my database cluster. Previously I did not do so and had less trouble connecting to QGIS. I know postgres out of the box comes with a default database cluster, so I am wondering if I am attempting to connect to the wrong cluster?

I have config files in two different directories as a result of the tutorial I followed: *with root user: /etc/postgresql/9.3/main *under postgres (default auto-created linux user): /var/lib/postgres/data

In any case after making my modifications I also restarted my postgres server and every time I start my server I do so from etc/init.d/postgresql. If so, how exactly do I go about fixing that without breaking my postgres installation?

My error is connection refused, but my port(5432) is listening when I checked with telnet. I am trying to connect with the add Postgis layer GUI option in QGIS Dufour installed on a windows box.

*my pg_hba entry is host all all 0.0.0.0/0 md5 *local_addresses was set to * in postgresql.conf

When I tried to connect on my database server via its local in the postgres user I tried psql -h 127.0.0.1 -U postgres -d postgres

...and I got "could not connect to server, etc", which leads me to believe the loopback is failing because wildcard should allow localhost as well.

Are you supposed to be able to connect to the server on a local machine or...? Do I have to change my iptables default settings?

*No particular errors on my postgresql installation stuck out.

share|improve this question
1  
Please improve your question, what are the errors.. how are you trying to connect. –  tudorbarascu Oct 22 '13 at 14:49
    
Can you post how you installed PostGIS? Were there any errors during the installation? –  mapBaker Oct 22 '13 at 15:47
1  
Have you tried to connect to the database locallly from the database server? what is the output when you do psql postgres postgres –  tudorbarascu Oct 22 '13 at 17:00
    
yes I have but it simply gives me the psql prompt. –  Carl Carlson Oct 22 '13 at 17:02
    
that's good, try connecting with qgis to the the same database (postgres) and with the same user. Just for testing put the firewall on the server down and post here the error, if any. –  tudorbarascu Oct 22 '13 at 17:58

1 Answer 1

I think I understand why it isn't working for you, I had this problem some time ago. Although you installed the database with the postgis extension try the "create extension postgis" before connecting to that database. This is why it gives you an error when it tries to do the "select postgis_version()" function. In conclusion, try and connect to a database that has postgis extension enabled.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.