Achmad Mardiansyah's Journal

Manage your knowledge by writing it

Mempersiapkan postgresql (Solaris 10)

without comments

Berikut ini catatan saya dalam mempersiapkan postgresql di solaris 10 agar siap digunakan. paket postgresql diambil dari opencsw.

install postgresql:

root#pkgutil -i postgresql

Persiapkan file konfigurasi & edit seperlunya terutama path utuk PGDATA, pg_ctl, initdb:

root# cp /opt/csw/etc/postgresql.conf.csw /opt/csw/etc/postgresql.conf
root# vi /opt/csw/etc/postgresql.conf

check initscript, edit seperlunya untuk pg_ctl & initdb:

root# vi /etc/init.d/cswpostgres

Setup initial database

root# /etc/init.d/cswpostgres initdb

Setup password untuk user postgres

root# /opt/csw/postgresql/bin/psql -U postgres
postgres=# \password postgres;
Enter new password:
Enter it again:

Setup access list postgresql

root# vi /opt/csw/var/pgdata/pg_hba.conf
contoh:
# "local" is for Unix domain socket connections only
local   all         postgres                               ident
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               md5
root# /etc/init.d/cswpostgres restart

Setting parameter postgresql (listen address, port, autovacuum, dll):

root# vi /opt/csw/var/pgdata/postgresql.conf

Beberapa command didalam postgresql:

postgres=# \du #display user
postgres=# \l #display database

Membuat user baru

user$ /opt/csw/postgresql/bin/psql -U postgres
Password for user postgres:
postgres=# CREATE ROLE glcstudent;
CREATE ROLE
postgres=# ALTER ROLE glcstudent WITH login;
ALTER ROLE
postgres=# ALTER ROLE glcstudent WITH password 'blablabla';
ALTER ROLE

Setup tablespace & database

root# mkdir -p /export/home/pgsql/sqlbasictbs
root# chown -R postgres:postgres /export/home/pgsql/sqlbasictbs
postgres=# CREATE TABLESPACE sqlbasictbs OWNER glcstudent LOCATION '/export/home/pgsql/sqlbasictbs';
CREATE TABLESPACE
postgres=# CREATE DATABASE sqlbasic OWNER glcstudent TABLESPACE sqlbasictbs;
CREATE DATABASE
Sekian, semoga bermanfaat

Leave a Reply