You need to ensure two things:
1) You need to configure your PostgreSQL server to allow TCP/IP
connections. You can do this by setting the "tcpip_socket" variable
to "true" in the postgresql.conf file (usually located in ~postgres/data).
Some older PostgreSQL daemons (prior 7.0) need to be started with the
"-i" commandline option.
2) You need to patch your pg_hba.conf to allow TCP/IP host
connections.
Example (for PostgreSQL 7.3):
local all all trust host all all 127.0.0.1 255.255.255.0 trust host all all 0.0.0.0 255.255.255.255 reject
Example (for PostgreSQL 7.2):
local all trust host all 127.0.0.1 255.255.255.0 trust host all 0.0.0.0 255.255.255.255 reject
To get a secure setup, replace trust with password, md5 or something else (depends on your PostgreSQL version).
Don't forget to restart PostgreSQL after applying the changes! (e.g. /etc/init.d/postgresql restart)