Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Friday, September 16, 2011

Install Postgres 8.3 di Centos 5.5

ini bukan kali pertama saya melakukan instalasi postgres, namun kali ini perlu saya tulis diblog ini, hitung-hitung biar makin inget, selain itu kali aja bisa bermanfaat buat yang lain (meskipun di internet sudah banyak tutor yang sama).

to the point aja..

step #1
melakukan remote ke server dimana database akan di install.

horasoctavianus@sihotang:~$ ssh root@dbserver
[root@dbserver ~]# 

step #2
me-remove PostgreSQL 8.1 (kalau sudah terinstall sebelumnya), karena versi ini secara default terdapat di Centos 5, dimana versi ini belum support untuk INSERT..RETURNING

[root@dbserver ~]#yum remove postgresql postgresql-server

step #3
menambahkan beberapa line dibawah ini ke /etc/yum.repos.d/CentOS-Base.repo dengan cara

[root@dbserver ~]vi /etc/yum.repos.d/CentOS-Base.repo
[base]
exclude=postgresql*
[updates]
exclude=postgresql*

step #4
men-download file instalasi

[root@dbserver ~]#wget http://yum.pgsqlrpms.org/reporpms/8.3/pgdg-centos-8.3-7.noarch.rpm

step #5
proses instalasi

[root@dbserver ~]#rpm -ivh pgdg-centos-8.3-7.noarch.rpm
[root@dbserver ~]#yum install postgresql postgresql-server

step #6
enable client authentication perlu dilakukan untuk memberikan akses remote (ex: Pgadmin) dari host/network yang lain.

[root@dbserver ~]#psql -Upostgres
Welcome to psql 8.3.11, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit postgres=#ALTER USER postgres WITH PASSWORD 'mypassword';
postgres=#\q


[root@dbserver ~]#chkconfig postgresql on
[root@dbserver ~]#servic
e postgresql initdb
[root@dbserver ~]#vi /var/lib/pgsql/data/pg_hba.conf


tambahkan line berikut (sesuaikan xx.xx.xx.xx dengan network/host yang diinginkan)

host all all xx.xx.xx.xx/24 trust
atau
host all all xx.xx.xx.xx/24 md5

step #7
meng-allow tcp/ip socket dengan meng-edit file /var/lib/pgsql/data/postgresql.conf, yaitu mengganti line:

listen_addresses='localhost'
menjadi
listen_addresses='*'
atau langsung memasukkan ip-address nya
listen_addresses='203.190.1.2 203.190.1.3'

step #8
restart service database postgresnya

[root@dbserver ~]#/etc/init.d/postgresql restart

semoga bermanfaat & selamat mencoba :)