You are here: Foswiki>ATLAS Web>PostgreSQL (06 Feb 2008, HenningPerl)Edit Attach



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
(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     trust

this allows hosts from the local network 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.
Topic revision: r1 - 06 Feb 2008, HenningPerl
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback