Aug 15 2008

Installing Postgres on Ubuntu 8.04

adam

This is  a fairly simple process (the client install is optional as pgadmin is a far better client):

sudo apt-get install postgresql postgresql-client

Install pgadmin:

sudo apt-get install pgadmin3

then you will need to reset the password for the postgres user:

$ sudo su postgres -c psql
postgres=# ALTER USER postgres WITH PASSWORD 'password';
postgres=# \q

You can now connect to postgres using pgadmin using the password you entered above.

If you want to be able to access Postgres from other computers than the one it is installed on then you will need to modify the /etc/postgresql/8.3/main/pg_hba.conf  (this is the location in Ubuntu).
The file has a large commented section describing how to configure access from other machines on your network but it boils down to adding an entry something like this:
host all postgres 192.168.1.0/24 md5
The above line tells postgres that the postgres user can access all databases from any machine in the 192.168.1.* subnet. Credentials will be sent encoded using md5. There are a bunch of more complicated ways that you can setup authentication but this basic example will get you started. Later you may want to use the ident authentication method and maintain dbusers in the pg_ident.conf file (located in the same directory as the ph_hba.conf file).