Setup
On Debian, the
PostgreSQl package automatically creates a user 'postgres'. For a quick start, do the following (assuming you installed version 7.4, home of user postgres is '/var/lib/postgresql'):
1. log in as root, 'su - postgres'
2. set environment variables
export PGDATA="/var/lib/postgresql/7.4/data"
export PATH="${PATH}:/usr/lib/postgresql/7.4/bin/"
3. create database 'test' in 7.4/data:
$ mkdir $PGDATA
$ initdb
$ createdb 'test'
4. now you can use the database, at least from localhost
$ psql test
Willkommen bei psql 7.4.19, dem interaktiven PostgreSQL-Terminal.
Geben Sie ein: \copyright für Urheberrechtsinformationen
\h für Hilfe über SQL-Anweisungen
\? für Hilfe über interne Anweisungen
\g oder Semikolon, um eine Anfrage auszuführen
\q um zu beenden
test=#
(at least that's how it should look like)
Network Access
To acces your database from your local network without login, do the following:
1. in your $PGDATA directory, you also find the configuration files. First, edit
pg_hba.conf (hba =
h ost
b ased
a ccess) and add
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
host test testuser 192.168.0.0 255.255.255.0 trust
this allows hosts from the local network 192.168.0.0/24 to log into the database 'test' using the user 'testuser'. Of course you have to create the user and database using 'createuser' and 'createdb'.
2. in the same directory, edit 'postgresql.conf
tcpip_socket = true
Now you can access the database over local network.