Saturday, January 03, 2009

PostgreSQL on HardyHeron

This is for Ubuntu (8.04 LTS) , but can be also applied for others.

=== Install PostgreSQL (8.3) ===

1/ Install the DBMS :

$ sudo apt-get install postgresql postgresql-contrib

(the postgresql-contrib is optional, it's just some additional facilities for Postgres)

2/ Install the GUI client (pgadmin or pg-client) to manage :

$ sudo apt-get install pgadmin3 postgresql-client

3/ Change password for user 'postgres' :

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

4/ Enable access from outside localhost (if needed) :

To do this, you may edit either postgresql.conf or pg_hba.conf or pg_ident.conf , their location in Ubuntu is /etc/postgresql/8.3/main/ . Perhaps the K.I.S.S way is to add a line into pg_hba.conf to pick the corresponding IPv4 subnet to be allowed:

host all postgres md5

(That line means all private IPs 192.168.1.x will be allowed to connect Postgres)

To make sure the change is applied, restart the deamon :

$ sudo /etc/init.d/postgresql-8.3 restart

=== Some basic PostgreSQL commands ===
(to be updated)

No comments: