Description:
This document provides simple, step-by-step instructions for installing PostgreSQL on Oracle Linux. It guides you through the entire process, from setup to configuration, ensuring you can get PostgreSQL up and running smoothly on your system. Perfect for quick and easy installation.
Table of Contents
1.Hardware Required
2.OS Details
3.Install the repository RPM
4.Disable the built-in PostgreSQL module
5.Install PostgreSQL
6.Initialize the database and enable automatic start
7.How to login PostgreSQL Database
- Hardware Required
The minimum hardware required to install and run PostgreSQL is:
1 GHz processor
2 GB of RAM
512 MB of HDD
Additional disk space is required for data
- OS Details
NAME=”Oracle Linux Server”
VERSION=”8.6″
- Install the repository RPM
- Disable the built-in PostgreSQL module
Importing GPG key 0x08B40D20:
Userid : “PostgreSQL RPM Repository pgsql-pkg-yum@lists.postgresql.org“
Fingerprint: D4BF 08AE 67A0 B4C7 A1DB CCD2 40BC A2B4 08B4 0D20
From : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL
Importing GPG key 0x08B40D20:
Userid : “PostgreSQL RPM Repository pgsql-pkg-yum@lists.postgresql.org“
Fingerprint: D4BF 08AE 67A0 B4C7 A1DB CCD2 40BC A2B4 08B4 0D20
From : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL
Importing GPG key 0x08B40D20:
Userid : “PostgreSQL RPM Repository pgsql-pkg-yum@lists.postgresql.org“
Fingerprint: D4BF 08AE 67A0 B4C7 A1DB CCD2 40BC A2B4 08B4 0D20
From : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL
Importing GPG key 0x08B40D20:
Userid : “PostgreSQL RPM Repository pgsql-pkg-yum@lists.postgresql.org“
Fingerprint: D4BF 08AE 67A0 B4C7 A1DB CCD2 40BC A2B4 08B4 0D20
From : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL
Importing GPG key 0x08B40D20:
Userid : “PostgreSQL RPM Repository pgsql-pkg-yum@lists.postgresql.org“
Fingerprint: D4BF 08AE 67A0 B4C7 A1DB CCD2 40BC A2B4 08B4 0D20
From : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL
Importing GPG key 0x08B40D20:
Userid : “PostgreSQL RPM Repository pgsql-pkg-yum@lists.postgresql.org“
Fingerprint: D4BF 08AE 67A0 B4C7 A1DB CCD2 40BC A2B4 08B4 0D20
From : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL
[root@postgres ~]#
- Install PostgreSQL
- Initialize the database and enable automatic start
Initializing database … OK
[root@postgres ~]# sudo systemctl enable postgresql-16
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql-16.service → /usr/lib/systemd/system/postgresql-16.service.
[root@postgres ~]# [root@postgres ~]# sudo systemctl start postgresql-16
[root@postgres ~]# sudo systemctl status postgresql-16
● postgresql-16.service – PostgreSQL 16 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-16.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2024-02-18 15:50:29 IST; 11s ago
Docs: https://www.postgresql.org/docs/16/static/
Process: 8575 ExecStartPre=/usr/pgsql-16/bin/postgresql-16-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 8581 (postgres)
Tasks: 7 (limit: 48705)
Memory: 17.7M
CGroup: /system.slice/postgresql-16.service
├─8581 /usr/pgsql-16/bin/postgres -D /var/lib/pgsql/16/data/
├─8582 postgres: logger
├─8583 postgres: checkpointer
├─8584 postgres: background writer
├─8586 postgres: walwriter
├─8587 postgres: autovacuum launcher
└─8588 postgres: logical replication launcher
Feb 18 15:50:29 postgres.net systemd[1]: Starting PostgreSQL 16 database server…
Feb 18 15:50:29 postgres.net postgres[8581]: 2024-02-18 15:50:29.585 IST [8581] LOG: redirecting log output to logging collector process
Feb 18 15:50:29 postgres.net postgres[8581]: 2024-02-18 15:50:29.585 IST [8581] HINT: Future log output will appear in directory “log”.
Feb 18 15:50:29 postgres.net systemd[1]: Started PostgreSQL 16 database server.
[root@postgres ~]#
- How to login PostgreSQL Database?
[postgres@postgres ~]$
[postgres@postgres ~]$ psql
psql (16.2)
Type “help” for help.
postgres=#
postgres=#exit
[postgres@postgres ~]$