I am working on this new ubuntu 12.04 server and I need to work on the Postgres database which is PostGIS enabled. The problem is I am not sure how to locate the database using command line. The server already has OpenGeo suite installed on it and so it definitely has PostGIS.

It is already installed on the server. I just need to locate it. How do I locate it?

1 Answer 1


I am not familar with the OpenGeo suite so I might not have the detail specific to you down but unless OpenGeo preloaded a template or sample database, you need to create a spatially enabled database yourself.

When I was learning how to effectively use PostGIS, this website had the easiest step-by-step instructions of how to setup yourself a spatially enabled template.

Linfiniti - Installing PostGIS2

If you have that all setup and just need command line access to PostgreSQL just type:

psql -d databasename

This will connect you to the database you want. Common options include:

-h for remote hosts, don't use if your server is on your local machine

-p to connect via non-standard port (which is 5432, fyi)

-U to login as a specific user other then your current user

-l list all available databses and templates and then quits

I hope this helps.

  • I tried psql but it keeps giving me this error, psql: FATAL: Ident authentication failed for user "myname"
    – Sam007
    Commented Nov 21, 2012 at 22:10
  • Oh sorry got it. I will need to work on creating a new database and connect it with the Geoserver. it was just, psql -d databasename -U username -h hostname -p 5432
    – Sam007
    Commented Nov 21, 2012 at 22:33
  • 2
    That means your user isn't setup as a user in psql. Change to the owner of the of the server instance. In Ubuntu repo setup it is postgres: sudo su postgres then just type psql once there type add user yourname with password 'password'; and also giver your self admin rights over your database with grant all privileges on database dbname to yourname;
    – RomaH
    Commented Nov 21, 2012 at 22:35
  • Good glad to here you got it.
    – RomaH
    Commented Nov 21, 2012 at 22:36
  • 1
    So you know, when you did su username you are actually three bash shells deep. Which isn't bad but could be confusing later on. So your real idenitity is now You > Postgres > You in your current shell. The correct way to get out of a su is to type the facepalming exit. :) Oops caught my error, Thanks.
    – RomaH
    Commented Nov 21, 2012 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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