Ярлыки

суббота, 3 ноября 2012 г.

Some steps for settings PostgreSQL


There are few steps for setting PostgreSQL:
0) pg_config --version
 - what version are installed?
1) pg_config --configure
  - see server configuration
2) sudo useradd postgres
 - command for add user
3) Make DB dir and delegate permissions to new user:
    mkdir /usr/local/pgsql/data
    chown postgres /usr/local/pgsql/data
4) starting DB:
    $ sudo - postgres
    pg$
5) Inizialize DB:
    pg$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
6) Starting DB again:
    /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
or 
   /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
7) permissions for remote host (not localhost) - in file /usr/local/pgsql/data/pg_hba.conf
in format: host - DB name - user - IP-address - mask - authentication (md5/trust)
  We must also write variable `listen_adresses="*"` in file postgresql.conf
8) start, stop and restart DB:
    pg_ctl start
    pg_ctl_stop
    pg_ctl_restart
9) test: connect to template "template1":
    psql -h 192.168.0.111 -d template1
10) reboot server
11) Then we must see for starting postmaster:
    ps -el | grep post
12) create DB:
    create_db ******
13) create user:
    CREATE USER myuser WITH password 'mypsw';

Комментариев нет:

Отправить комментарий