Site icon Learning & Doing

Cara Install PostgreSQL pada Rocky Linux

postgresql

“Cara Install PostgreSQL pada Rocky Linux”

PostgreSQL adalah salah satu platform database yang biasa di gunakan untuk membangun sebuah sistem baik aplikasi web ataupun aplikasi dekstop dan mobile , biasanya membutuhkan database untuk menyimpan data client , transaksi dan data lain nya.

Installasi

dnf module list postgresql

Nanti muncul tampilan berikut :

Rocky Linux 8 - AppStream
Name                                Stream                          Profiles                                    Summary                                                     
postgresql                          9.6                             client, server [d]                          PostgreSQL server and client module                         
postgresql                          10 [d]                          client, server [d]                          PostgreSQL server and client module                         
postgresql                          12                              client, server [d]                          PostgreSQL server and client module                         
postgresql                          13                              client, server [d]                          PostgreSQL server and client module                         

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

Pada tampilan di atas terdapat beberapa versi postgresql yang bisa kamu install kan.

Misalkan kita coba install kan versi 13.

dnf -qy module enable postgresql:13
dnf info postgresql-server
Available Packages
Name         : postgresql-server
Version      : 13.3
Release      : 1.module+el8.4.0+546+3620623e
Architecture : x86_64
Size         : 5.6 M
Source       : postgresql-13.3-1.module+el8.4.0+546+3620623e.src.rpm
Repository   : appstream
Summary      : The programs needed to create and run a PostgreSQL server
URL          : http://www.postgresql.org/
License      : PostgreSQL
dnf install postgresql-server
Dependencies resolved.
============================================================================================================================================================================
 Package                                  Architecture                  Version                                                      Repository                        Size
============================================================================================================================================================================
Installing:
 postgresql-server                        x86_64                        13.3-1.module+el8.4.0+546+3620623e                           appstream                        5.6 M
Installing dependencies:
 libicu                                   x86_64                        60.3-2.el8_1                                                 baseos                           8.8 M
 libpq                                    x86_64                        13.3-1.el8_4                                                 appstream                        196 k
 postgresql                               x86_64                        13.3-1.module+el8.4.0+546+3620623e                           appstream                        1.5 M

Transaction Summary
============================================================================================================================================================================
Install  4 Packages

Total download size: 16 M
Installed size: 59 M
Is this ok [y/N]: y
postgres -V
postgres (PostgreSQL) 13.3
postgresql-setup --initdb
systemctl enable --now postgresql
systemctl status postgresql
● postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2021-09-07 09:42:14 EAT; 47s ago
  Process: 15684 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=0/SUCCESS)
 Main PID: 15686 (postmaster)
    Tasks: 8 (limit: 4938)
   Memory: 16.8M
   CGroup: /system.slice/postgresql.service
           ├─15686 /usr/bin/postmaster -D /var/lib/pgsql/data
           ├─15688 postgres: logger   
           ├─15690 postgres: checkpointer   
           ├─15691 postgres: background writer   
           ├─15692 postgres: walwriter   
           ├─15693 postgres: autovacuum launcher   
           ├─15694 postgres: stats collector   
           └─15695 postgres: logical replication launcher   

Sep 07 09:42:13 rocky8 systemd[1]: Starting PostgreSQL database server...
Sep 07 09:42:13 rocky8 postmaster[15686]: 2021-09-07 09:42:13.544 EAT [15686] LOG:  starting PostgreSQL 12.7 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 8.4.1 202009>
Sep 07 09:42:13 rocky8 postmaster[15686]: 2021-09-07 09:42:13.545 EAT [15686] LOG:  listening on IPv6 address "::1", port 5432
Sep 07 09:42:13 rocky8 postmaster[15686]: 2021-09-07 09:42:13.545 EAT [15686] LOG:  listening on IPv4 address "127.0.0.1", port 5432
Sep 07 09:42:13 rocky8 postmaster[15686]: 2021-09-07 09:42:13.687 EAT [15686] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
Sep 07 09:42:13 rocky8 postmaster[15686]: 2021-09-07 09:42:13.962 EAT [15686] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
Sep 07 09:42:14 rocky8 postmaster[15686]: 2021-09-07 09:42:14.130 EAT [15686] LOG:  redirecting log output to logging collector process
Sep 07 09:42:14 rocky8 postmaster[15686]: 2021-09-07 09:42:14.130 EAT [15686] HINT:  Future log output will appear in directory "log".
Sep 07 09:42:14 rocky8 systemd[1]: Started PostgreSQL database server.

Note : Untuk install versi yang lain nya , anda bisa mengikuti cara tersebut di atas.

Exit mobile version