Toggle navigation

Penggunakan Repository Postgresql

Version 1.0.0

Saat ini Mirror Telkom University telah menyediakan repositori untuk aplikasi postgresql mulai dari versi 9.6 sampai versi 12. Repositori postgresql saat ini hanya dapat di gunakan oleh sistem operasi debian, ubuntu, fedora serta redhat berikut turunannya seperti : RHEL, CEntOS.

Untuk cara penggunaan terdapat sedikit konfigurasi pada file repo. dengan cara :

Pada repositori postgresql untuk turunan redhat dapat digunakan oleh beberapa sistem operasi di antaranya :

  • RHEL
  • Oracle Linux
  • CEntOS

 

Konfigurasi Repositori REDHAT

Konfigurasi repositori dilakukan dengan cara copy baris dibawah ini pada terminal konsol anda dengan user root.

echo '# PGDG Red Hat Enterprise Linux / CentOS stable repositories:

[pgdg12]
name=PostgreSQL 12 for RHEL/CentOS $releasever - $basearch
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/12/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg11]
name=PostgreSQL 11 for RHEL/CentOS $releasever - $basearch
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/11/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg10]
name=PostgreSQL 10 for RHEL/CentOS $releasever - $basearch
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/10/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg96]
name=PostgreSQL 9.6 for RHEL/CentOS $releasever - $basearch
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/9.6/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg95]
name=PostgreSQL 9.5 for RHEL/CentOS $releasever - $basearch
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/9.5/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg94]
name=PostgreSQL 9.4 for RHEL/CentOS $releasever - $basearch
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/9.4/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

# PGDG for RHEL/CentOS Updates Testing repositories. (These packages should not be used in production)
# Available for 9.6 and above.

[pgdg13-updates-testing]
name=PostgreSQL 13 for RHEL/CentOS $releasever - $basearch - Updates testing
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/testing/13/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg12-updates-testing]
name=PostgreSQL 12 for RHEL/CentOS $releasever - $basearch - Updates testing
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/testing/12/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg11-updates-testing]
name=PostgreSQL 11 for RHEL/CentOS $releasever - $basearch - Updates testing
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/testing/11/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg10-updates-testing]
name=PostgreSQL 10 for RHEL/CentOS $releasever - $basearch - Updates testing
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/testing/10/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg96-updates-testing]
name=PostgreSQL 9.6 for RHEL/CentOS $releasever - $basearch - Updates testing
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/testing/9.6/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

# Source RPMs (SRPM), and their testing repositories:

[pgdg12-source]
name=PostgreSQL 12 for RHEL/CentOS $releasever - $basearch - Source
failovermethod=priority
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/srpms/12/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg12-source-updates-testing]
name=PostgreSQL 12 for RHEL/CentOS $releasever - $basearch - Source update testing
failovermethod=priority
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/srpms/testing/12/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg11-source]
name=PostgreSQL 11 for RHEL/CentOS $releasever - $basearch - Source
failovermethod=priority
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/srpms/11/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg11-source-updates-testing]
name=PostgreSQL 11 for RHEL/CentOS $releasever - $basearch - Source update testing
failovermethod=priority
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/srpms/testing/11/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg10-source]
name=PostgreSQL 10 for RHEL/CentOS $releasever - $basearch - Source
failovermethod=priority
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/srpms/10/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg10-source-updates-testing]
name=PostgreSQL 10 for RHEL/CentOS $releasever - $basearch - Source update testing
failovermethod=priority
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/srpms/testing/10/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg96-source]
name=PostgreSQL 9.6 for RHEL/CentOS $releasever - $basearch - Source
failovermethod=priority
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/srpms/9.6/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg96-source-updates-testing]
name=PostgreSQL 9.6 for RHEL/CentOS $releasever - $basearch - Source update testing
failovermethod=priority
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/srpms/testing/9.6/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg95-source]
name=PostgreSQL 9.5 for RHEL/CentOS $releasever - $basearch - Source
failovermethod=priority
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/srpms/9.5/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

[pgdg94-source]
name=PostgreSQL 9.4 for RHEL/CentOS $releasever - $basearch - Source
failovermethod=priority
baseurl=https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/yum/srpms/9.4/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG' > /etc/yum.repos.d/pgdg-redhat-all.repo

 

Periksa list repositori

Lakukan Perintah di bawah ini untuk mendapatkan informasi list repositori :

yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * centos-base: mirror.telkomuniversity.ac.id
 * centos-extras: mirror.telkomuniversity.ac.id
 * centos-updates: mirror.telkomuniversity.ac.id
 * epel: mirror.telkomuniversity.ac.id
repo id                                                       repo name                                                                                           status
!centos-base/7/x86_64                                         CentOS-7 - Base                                                                                     10,097
!centos-extras/7/x86_64                                       CentOS-7 - Extras                                                                                      307
!centos-updates/7/x86_64                                      CentOS-7 - Updates                                                                                   1,012
!epel/x86_64                                                  Extra Packages for Enterprise Linux 7 - x86_64                                                      13,509
!pgdg10/7/x86_64                                              PostgreSQL 10 for RHEL/CentOS 7 - x86_64                                                             1,181
!pgdg11/7/x86_64                                              PostgreSQL 11 for RHEL/CentOS 7 - x86_64                                                             1,018
!pgdg12/7/x86_64                                              PostgreSQL 12 for RHEL/CentOS 7 - x86_64                                                               358
!pgdg94/7/x86_64                                              PostgreSQL 9.4 for RHEL/CentOS 7 - x86_64                                                            1,092
!pgdg95/7/x86_64                                              PostgreSQL 9.5 for RHEL/CentOS 7 - x86_64                                                            1,158
!pgdg96/7/x86_64                                              PostgreSQL 9.6 for RHEL/CentOS 7 - x86_64                                                            1,201
repolist: 35,414
[root@proline mesync]#

 

Instalasi Postgresql pada REDHAT

Instalasi postgresql dapat dilakukan dengan cara :

yum install postgresqlNUMBER postgresqlNUMBER-server postgresqlNUMBER-contrib

NUMBER adalah Versi postgresql yang akan di instal

Contoh pada artikel kali ini adalah instalasi postgresql versi 12, maka pada terminal konsol dapat di ketik

sudo yum install postgresql12 postgresql12-server postgresql12-contrib

 

Hasilnya akan seperti di bawah ini :

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * centos-base: mirror.telkomuniversity.ac.id
 * centos-extras: mirror.telkomuniversity.ac.id
 * centos-updates: mirror.telkomuniversity.ac.id
 * epel: mirror.telkomuniversity.ac.id
Resolving Dependencies
--> Running transaction check
---> Package postgresql12.x86_64 0:12.1-2PGDG.rhel7 will be installed
--> Processing Dependency: postgresql12-libs(x86-64) = 12.1-2PGDG.rhel7 for package: postgresql12-12.1-2PGDG.rhel7.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql12-12.1-2PGDG.rhel7.x86_64
---> Package postgresql12-contrib.x86_64 0:12.1-2PGDG.rhel7 will be installed
---> Package postgresql12-server.x86_64 0:12.1-2PGDG.rhel7 will be installed
--> Running transaction check
---> Package postgresql12-libs.x86_64 0:12.1-2PGDG.rhel7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                                         Arch                              Version                                      Repository                         Size
========================================================================================================================================================================
Installing:
 postgresql12                                    x86_64                            12.1-2PGDG.rhel7                             pgdg12                            2.7 M
 postgresql12-contrib                            x86_64                            12.1-2PGDG.rhel7                             pgdg12                            2.0 M
 postgresql12-server                             x86_64                            12.1-2PGDG.rhel7                             pgdg12                             13 M
Installing for dependencies:
 postgresql12-libs                               x86_64                            12.1-2PGDG.rhel7                             pgdg12                            759 k

Transaction Summary
========================================================================================================================================================================
Install  3 Packages (+1 Dependent package)

Total download size: 18 M
Installed size: 76 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): postgresql12-12.1-2PGDG.rhel7.x86_64.rpm                                                                                                  | 2.7 MB  00:00:00
(2/4): postgresql12-contrib-12.1-2PGDG.rhel7.x86_64.rpm                                                                                          | 2.0 MB  00:00:00
(3/4): postgresql12-libs-12.1-2PGDG.rhel7.x86_64.rpm                                                                                             | 759 kB  00:00:00
(4/4): postgresql12-server-12.1-2PGDG.rhel7.x86_64.rpm                                                                                           |  13 MB  00:00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                    15 MB/s |  18 MB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : postgresql12-libs-12.1-2PGDG.rhel7.x86_64                                                                                                            1/4
  Installing : postgresql12-12.1-2PGDG.rhel7.x86_64                                                                                                                 2/4
  Installing : postgresql12-server-12.1-2PGDG.rhel7.x86_64                                                                                                          3/4
  Installing : postgresql12-contrib-12.1-2PGDG.rhel7.x86_64                                                                                                         4/4
  Verifying  : postgresql12-libs-12.1-2PGDG.rhel7.x86_64                                                                                                            1/4
  Verifying  : postgresql12-server-12.1-2PGDG.rhel7.x86_64                                                                                                          2/4
  Verifying  : postgresql12-12.1-2PGDG.rhel7.x86_64                                                                                                                 3/4
  Verifying  : postgresql12-contrib-12.1-2PGDG.rhel7.x86_64                                                                                                         4/4

Installed:
  postgresql12.x86_64 0:12.1-2PGDG.rhel7            postgresql12-contrib.x86_64 0:12.1-2PGDG.rhel7            postgresql12-server.x86_64 0:12.1-2PGDG.rhel7

Dependency Installed:
  postgresql12-libs.x86_64 0:12.1-2PGDG.rhel7

Complete!
You have new mail in /var/spool/mail/root
[root@proline mesync]#

 

Pada distro linux turunan debian, Postgresql dapat di install pada sistem operasi Debian dan Ubuntu dengan versi sistem operasi :

  • Debian Buster (10.x)
  • Debian Stretch (9.x)
  • Debian Jessie (8.x)
  • Ubuntu Bionic (18.04)
  • Ubuntu Xenial (16.04)

 

Konfigurasi Repositori UBUNTU/DEBIAN

Ketik Perindah dibawah ini pada terminal konsol :

sudo sh -c 'echo "deb http://mirror.telkomuniversity.ac.id/postgresql/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

Download signkey dan lakukan update repositori

wget --quiet -O - https://mirror.telkomuniversity.ac.id/postgresql/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update

Instalasi Postgresql pada UBUNTU/DEBIAN

instalasi postgresql dapat dilakukan dengan cara

sudo apt-get install postgresql-NUMBER

NUMBER adalah Versi postgresql yang akan di instal

Contoh :

sudo apt-get install postgresql-12