Install PostgreSQL

Material

PostgreSQL versi 8.1, versi 9.3
Red Hat Enterprise Linux 6.6 Santiago

Langkah-langkah

  1. Ekstrak file
    [root@localhost]$ tar xvf postgresql.tar.gz
    
  2. Masuk ke folder hasil ekstrak
    [root@localhost]$ cd postgresql_folder
    
  3. Konfigurasi
    [root@localhost postgresql_folder]$ ./configure
    
    Jika ada error readline dan zlib, tambahkan menggunakan yum Atau jika tidak memakai paket tersebut, bisa tambahkan parameter berikut.
    [root@localhost postgresql_folder]$ ./configure --without-readline --without-zlib
    
  4. Make dan make install
    [root@localhost postgresql_folder]$ make
    [root@localhost postgresql_folder]$ make install
    
  5. Tambahkan PATH dan PGDATA
    [root@localhost]$ cd
    [root@localhost]$ vim .bash_profile
    export PATH=/usr/local/pgsql/bin:$PATH
    export PGDATA=/usr/local/pgsql/data
    
  6. Buat user sendiri untuk postgres
    [root@localhost]$ adduser postgres
    
  7. Ubah owner folder instalasi
    [root@localhost]$ chown -R /usr/local/pgsql
    
  8. Buat folder data
    [root@localhost]$ mkdir /usr/local/pgsql/data
    
  9. Sebelumnya, exit user agar variabel environment tadi bekerja
    [root@localhost]$ exit
    
  10. Inisialisasi database
    [root@localhost]$ initdb -D $PGDATA
    
  11. start database
    [root@localhost]$ pg_ctl -D $PGDATA start
    
  12. Buat otomatisasi start database on-boot.
    [root@localhost]$ cd postgresql_folder #folder hasil ekstrak
    [root@localhost postgresql_folder]$ cd contrib/start-scripts
    [root@localhost postgresql_folder]$ cp linux /etc/init.d
    [root@localhost init.d]$ cd /etc/init.d
    [root@localhost init.d]$ mv linux postgresql
    [root@localhost init.d]$ chmod +x postgresql
    [root@localhost init.d]$ chkconfig --add postgresql
    [root@localhost init.d]$ chkconfig --list postgresql #cek apakah sudah on
    
  13. Ubah konfigurasi agar bisa diakses dari klien
    [root@localhost]$ vim $PGDATA/postgresql.conf
    (hapus tanda # atau uncomment)
    listen_addresses = * 
    [root@localhost]$ vim $PGDATA/pg_hba.conf
    (tambahkan)
    HOST ALL ALL ip_klien/32 trust
    
  14. Konfigurasi firewall untuk port PostgreSQL 5432 atau matikan saja

results matching ""

    No results matching ""