Rocky Linux update:
[root@rocky ~]# cat /etc/rocky-release
Rocky Linux release 9.8 (Blue Onyx)
[root@rocky ~]# dnf update --assumeyes
[root@rocky ~]# dnf install --assumeyes tree lsof git
PostgreSQL installation:
#
# disable Rocky Linux built-in PostgreSQL module streams for version 13:
#
[root@rocky ~]# dnf list available postgresql-server
Last metadata expiration check: 0:01:01 ago on Mon 03 Aug 2026 05:28:45 PM UTC.
Available Packages
[[blue:postgresql-server.x86_64]] 13.23-3.el9_8 appstream
[root@rocky ~]# dnf --quiet --assumeyes module disable postgresql
#
# download and install the official PostgreSQL RIM repo:
#
[root@rocky ~]# cd /tmp
[root@rocky tmp]# curl --location --remote-name https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 12838 100 12838 0 0 266k 0 --:--:-- --:--:-- --:--:-- 272k
[root@rocky tmp]# ls -l pgdg-redhat-repo-latest.noarch.rpm
-rw-r--r--. 1 root root 12838 Aug 3 17:37 pgdg-redhat-repo-latest.noarch.rpm
[root@rocky tmp]# dnf localinstall --assumeyes /tmp/pgdg-redhat-repo-latest.noarch.rpm
DigitalOcean Droplet Agent 87 kB/s | 3.5 kB 00:00
Dependencies resolved.
=================================================================================================================
Package Architecture Version Repository Size
=================================================================================================================
Installing:
pgdg-redhat-repo noarch 42.0-66.rhel9PGDG @commandline 13 k
Transaction Summary
=================================================================================================================
Install 1 Package
Total size: 13 k
Installed size: 16 k
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction
Preparing : 1/1
Installing : pgdg-redhat-repo-42.0-66.rhel9PGDG.noarch 1/1
Verifying : pgdg-redhat-repo-42.0-66.rhel9PGDG.noarch 1/1
Installed:
pgdg-redhat-repo-42.0-66.rhel9PGDG.noarch
Complete!
[root@rocky tmp]# dnf list available postgresql18-server --assumeyes
PostgreSQL common RPMs for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 4.4 kB/s | 659 B 00:00
PostgreSQL common RPMs for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 2.4 MB/s | 2.4 kB 00:00
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
PostgreSQL common RPMs for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 4.1 MB/s | 899 kB 00:00
PostgreSQL 18 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 6.9 kB/s | 659 B 00:00
PostgreSQL 18 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 2.4 MB/s | 2.4 kB 00:00
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
PostgreSQL 18 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 2.1 MB/s | 717 kB 00:00
PostgreSQL 17 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 9.4 kB/s | 659 B 00:00
PostgreSQL 17 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 2.4 MB/s | 2.4 kB 00:00
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
PostgreSQL 17 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 7.1 MB/s | 1.2 MB 00:00
PostgreSQL 16 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 8.9 kB/s | 659 B 00:00
PostgreSQL 16 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 2.4 MB/s | 2.4 kB 00:00
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
PostgreSQL 16 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 5.0 MB/s | 1.5 MB 00:00
PostgreSQL 15 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 7.2 kB/s | 659 B 00:00
PostgreSQL 15 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 2.4 MB/s | 2.4 kB 00:00
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
PostgreSQL 15 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 6.6 MB/s | 1.7 MB 00:00
PostgreSQL 14 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 3.1 kB/s | 659 B 00:00
PostgreSQL 14 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 2.4 MB/s | 2.4 kB 00:00
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
PostgreSQL 14 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 5.4 MB/s | 2.0 MB 00:00
Available Packages
postgresql18-server.x86_64 18.4-2PGDG.rhel9.8 pgdg18
[root@rocky tmp]# rm pgdg-redhat-repo-latest.noarch.rpm
rm: remove regular file 'pgdg-repo.rpm'? [[yellow:y]]
#
# install PostgreSQL 18:
#
[root@rocky tmp]# dnf install --assumeyes postgresql18-server
Last metadata expiration check: 0:01:31 ago on Sun 02 Aug 2026 07:42:59 PM UTC.
Dependencies resolved.
=================================================================================================================
Package Architecture Version Repository Size
=================================================================================================================
Installing:
[[green:postgresql18-server]] x86_64 18.4-2PGDG.rhel9.8 pgdg18 7.2 M
Installing dependencies:
[[green:libicu]] x86_64 67.1-10.el9_6 baseos 9.6 M
[[green:postgresql18]] x86_64 18.4-2PGDG.rhel9.8 pgdg18 2.0 M
[[green:postgresql18-libs]] x86_64 18.4-2PGDG.rhel9.8 pgdg18 301 k
Transaction Summary
=================================================================================================================
Install 4 Packages
Total download size: 19 M
Installed size: 75 M
Downloading Packages:
(1/4): postgresql18-libs-18.4-2PGDG.rhel9.8.x86_64.rpm 4.0 MB/s | 301 kB 00:00
(2/4): postgresql18-18.4-2PGDG.rhel9.8.x86_64.rpm 21 MB/s | 2.0 MB 00:00
(3/4): libicu-67.1-10.el9_6.x86_64.rpm 23 MB/s | 9.6 MB 00:00
(4/4): postgresql18-server-18.4-2PGDG.rhel9.8.x86_64.rpm 13 MB/s | 7.2 MB 00:00
-----------------------------------------------------------------------------------------------------------------
Total 32 MB/s | 19 MB 00:00
PostgreSQL 18 for RHEL / Rocky Linux / AlmaLinux 9 - x86_64 2.4 MB/s | 2.4 kB 00:00
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
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : libicu-67.1-10.el9_6.x86_64 1/4
Installing : postgresql18-libs-18.4-2PGDG.rhel9.8.x86_64 2/4
Running scriptlet: postgresql18-libs-18.4-2PGDG.rhel9.8.x86_64 2/4
Installing : postgresql18-18.4-2PGDG.rhel9.8.x86_64 3/4
Running scriptlet: postgresql18-18.4-2PGDG.rhel9.8.x86_64 3/4
Running scriptlet: postgresql18-server-18.4-2PGDG.rhel9.8.x86_64 4/4
Creating group 'postgres' with GID 26.
Creating user 'postgres' (PostgreSQL Server) with UID 26 and GID 26.
Installing : postgresql18-server-18.4-2PGDG.rhel9.8.x86_64 4/4
Running scriptlet: postgresql18-server-18.4-2PGDG.rhel9.8.x86_64 4/4
Verifying : postgresql18-18.4-2PGDG.rhel9.8.x86_64 1/4
Verifying : postgresql18-libs-18.4-2PGDG.rhel9.8.x86_64 2/4
Verifying : postgresql18-server-18.4-2PGDG.rhel9.8.x86_64 3/4
Verifying : libicu-67.1-10.el9_6.x86_64 4/4
Installed:
libicu-67.1-10.el9_6.x86_64 postgresql18-18.4-2PGDG.rhel9.8.x86_64
postgresql18-libs-18.4-2PGDG.rhel9.8.x86_64 postgresql18-server-18.4-2PGDG.rhel9.8.x86_64
Complete!
[root@rocky tmp]# dnf repoquery --installed --list postgresql18-server
/etc/pam.d/postgresql
/etc/sysconfig/pgsql
/run/postgresql
/usr/bin/postgresql-18-setup
/usr/lib/.build-id
::
::
::
::
/var/lib/pgsql
/var/lib/pgsql/18
/var/lib/pgsql/18/backups
/var/lib/pgsql/18/data
[root@rocky tmp]# dnf list installed postgresql18-server
Installed Packages
[[red:postgresql18.x86_64]] 18.4-2PGDG.rhel9.8 @pgdg18
[root@rocky tmp]# systemctl status postgresql-18.service
[[red:○]] postgresql-18.service - PostgreSQL 18 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-18.service; disabled; preset: disabled)
Active: [[red:inactive (dead)]]
Docs: https://www.postgresql.org/docs/18/static/
[root@rocky tmp]# grep postgres /etc/group /etc/passwd
/etc/group:postgres:x:26:
/etc/passwd:postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/usr/bin/bash
[root@rocky tmp]# id -a postgres
uid=26(postgres) gid=26(postgres) groups=26(postgres)
PostgreSQL database initilization:
[root@rocky tmp]# su - postgres
Last login: Mon Aug 3 18:04:57 UTC 2026 on pts/0
[postgres@rocky ~]$ whoami
postgres
[postgres@rocky ~]$ tree /var/lib/pgsql/18
/var/lib/pgsql/18
├── backups
└── data
2 directories, 0 files
#
# initdb:
#
[postgres@rocky ~]$ which postgresql-18-setup
/usr/bin/postgresql-18-setup
[postgres@rocky ~]$ file $(which postgresql-18-setup)
/usr/bin/postgresql-18-setup: symbolic link to ../../../../../../../../../../../../../..//usr/pgsql-18/bin/postgresql-18-setup
[postgres@rocky ~]$ ls -l /var/lib/pgsql/18/data
total 0 ${PGDATA}
[postgres@rocky ~]$ /usr/pgsql-18/bin/postgresql-18-setup initdb
Initializing database...
[postgres@rocky ~]$ ls -l /var/lib/pgsql/18/data
total 0 ---nothing?
[postgres@rocky ~]$ ls -l /var/lib/pgsql/18
drwx------. 2 postgres postgres 6 May 21 05:59 backups
drwx------. 2 postgres postgres 6 May 21 05:59 data
-rw-------. 1 postgres postgres 86 Aug 3 18:12 initdb.log
[postgres@rocky ~]$ cat /var/lib/pgsql/18/initdb.log
[[blue:runuser: may not be used by non-root users]]
[postgres@rocky ~]$ exit
logout
#
# postgresql-18-setup initdb must run by "root":
#
[root@rocky tmp]# /usr/pgsql-18/bin/postgresql-18-setup initdb
Initializing database ... OK
[root@rocky tmp]# systemctl status postgresql-18.service
○ postgresql-18.service - PostgreSQL 18 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-18.service; disabled; preset: disabled)
Active: [[red:inactive (dead)]]
Docs: https://www.postgresql.org/docs/18/static/
[root@rocky tmp]# systemctl enable --now postgresql-18.service
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql-18.service → /usr/lib/systemd/system/postgresql-18.service.
[root@rocky tmp]# systemctl status postgresql-18.service
[[green:●]] postgresql-18.service - PostgreSQL 18 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-18.service; enabled; preset: disabled)
Active: [[green:active (running)]] since Sun 2026-08-02 20:03:13 UTC; 17s ago
Docs: https://www.postgresql.org/docs/18/static/
Process: 61854 ExecStartPre=/usr/pgsql-18/bin/postgresql-18-check-db-dir ${PGDATA} (code=exited, status=0/SU>
Main PID: 61859 (postgres)
Tasks: 10 (limit: 4303)
Memory: 22.1M (peak: 22.3M)
CPU: 68ms
CGroup: /system.slice/postgresql-18.service
├─61859 /usr/pgsql-18/bin/postgres -D /var/lib/pgsql/18/data/
├─61860 "postgres: logger "
├─61861 "postgres: io worker 2"
├─61862 "postgres: io worker 1"
├─61863 "postgres: io worker 0"
├─61864 "postgres: checkpointer "
├─61865 "postgres: background writer "
├─61867 "postgres: walwriter "
├─61868 "postgres: autovacuum launcher "
└─61869 "postgres: logical replication launcher "
Aug 02 20:03:13 rocky systemd[1]: Starting PostgreSQL 18 database server...
Aug 02 20:03:13 rocky postgres[61859]: 2026-08-02 20:03:13.682 UTC [61859] LOG: redirecting log output to loggi>
Aug 02 20:03:13 rocky postgres[61859]: 2026-08-02 20:03:13.682 UTC [61859] HINT: Future log output will appear >
Aug 02 20:03:13 rocky systemd[1]: Started PostgreSQL 18 database server.
[root@rocky tmp]# ps aux | grep ^postgres
postgres 61859 0.0 4.0 222668 31496 ? Ss 20:03 0:00 /usr/pgsql-18/bin/postgres -D /var/lib/pgsql/18/data/
postgres 61860 0.0 0.9 69272 7152 ? Ss 20:03 0:00 postgres: logger
postgres 61861 0.0 0.9 222668 7464 ? Ss 20:03 0:00 postgres: io worker 2
postgres 61862 0.0 1.0 222800 8180 ? Ss 20:03 0:00 postgres: io worker 1
postgres 61863 0.0 1.2 222800 9492 ? Ss 20:03 0:00 postgres: io worker 0
postgres 61864 0.0 0.9 222800 7384 ? Ss 20:03 0:00 postgres: checkpointer
postgres 61865 0.0 1.0 222824 8484 ? Ss 20:03 0:00 postgres: background writer
postgres 61867 0.0 1.5 222800 11884 ? Ss 20:03 0:00 postgres: walwriter
postgres 61868 0.0 1.3 224248 10956 ? Ss 20:03 0:00 postgres: autovacuum launcher
postgres 61869 0.0 1.3 224248 10204 ? Ss 20:03 0:00 postgres: logical replication launcher
[root@rocky tmp]# lsof -P -i TCP:postgres
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
postgres 61859 postgres 7u IPv6 119193 0t0 TCP rocky:5432 (LISTEN)
postgres 61859 postgres 8u IPv4 119194 0t0 TCP rocky:5432 (LISTEN)
Working with PostgreSQL:
[root@rocky tmp]# su - postgres
Last login: Mon Aug 3 18:05:09 UTC 2026 on pts/0
[postgres@rocky ~]$ whoami
postgres
[postgres@rocky ~]$ ls -l /var/lib/pgsql/18/data
drwx------. 5 postgres postgres 33 Aug 3 18:16 base
drwx------. 2 postgres postgres 4096 Aug 3 18:16 global
drwx------. 2 postgres postgres 6 Aug 3 18:16 log
drwx------. 2 postgres postgres 6 Aug 3 18:16 pg_commit_ts
drwx------. 2 postgres postgres 6 Aug 3 18:16 pg_dynshmem
-rw-------. 1 postgres postgres 5509 Aug 3 18:16 pg_hba.conf
-rw-------. 1 postgres postgres 2681 Aug 3 18:16 pg_ident.conf
drwx------. 4 postgres postgres 68 Aug 3 18:16 pg_logical
drwx------. 4 postgres postgres 36 Aug 3 18:16 pg_multixact
drwx------. 2 postgres postgres 6 Aug 3 18:16 pg_notify
drwx------. 2 postgres postgres 6 Aug 3 18:16 pg_replslot
drwx------. 2 postgres postgres 6 Aug 3 18:16 pg_serial
drwx------. 2 postgres postgres 6 Aug 3 18:16 pg_snapshots
drwx------. 2 postgres postgres 25 Aug 3 18:16 pg_stat
drwx------. 2 postgres postgres 6 Aug 3 18:16 pg_stat_tmp
drwx------. 2 postgres postgres 18 Aug 3 18:16 pg_subtrans
drwx------. 2 postgres postgres 6 Aug 3 18:16 pg_tblspc
drwx------. 2 postgres postgres 6 Aug 3 18:16 pg_twophase
-rw-------. 1 postgres postgres 3 Aug 3 18:16 PG_VERSION
drwx------. 4 postgres postgres 77 Aug 3 18:16 pg_wal
drwx------. 2 postgres postgres 18 Aug 3 18:16 pg_xact
-rw-------. 1 postgres postgres 88 Aug 3 18:16 postgresql.auto.conf
-rw-------. 1 postgres postgres 32567 Aug 3 18:16 postgresql.conf
[postgres@rocky ~]$ psql
psql (18.4)
Type "help" for help.
postgres=# \list
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | Locale | ICU Rules | Access privileges
----------------+----------+----------+-----------------+-------------+-------------+--------+-----------+-----------------------
postgres | postgres | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | |
template0 | postgres | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
(3 rows)
postgres=# \du+
List of roles
Role name | Attributes | Description
-----------+------------------------------------------------------------+-------------
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS |
postgres=# CREATE USER kmaau WITH PASSWORD 'passw0rd';
CREATE ROLE
postgres=# \du+ kmaau;
List of roles
Role name | Attributes | Description
-----------+------------+-------------
kmaau | |
postgres=# CREATE DATABASE liquibase_demo;
CREATE DATABASE
postgres=# \list liquibase_demo
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | Locale | ICU Rules | Access privileges
----------------+-------+----------+-----------------+-------------+-------------+--------+-----------+-------------------
liquibase_demo | kmaau | UTF8 | libc | en_US.UTF-8 | en_US.UTF-8 | | |
(1 row)
postgres=# \quit
[postgres@rocky ~]$ exit
logout
Java installation:
[root@rocky tmp]# which java
[[red:/usr/bin/which: no java in (/root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)]]
[root@rocky tmp]# dnf list available java-*
Last metadata expiration check: 0:01:07 ago on Mon 03 Aug 2026 03:54:34 AM UTC.
Available Packages
java-1.8.0-openjdk.x86_64 1:1.8.0.502.b07-1.2.el9_8 appstream
java-1.8.0-openjdk-demo.x86_64 1:1.8.0.502.b07-1.2.el9_8 appstream
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.502.b07-1.2.el9_8 appstream
::
::
::
java-21-openjdk-static-libs.x86_64 1:21.0.12.0.8-1.2.el9_8 appstream
java-25-openjdk.x86_64 1:25.0.4.0.7-1.1.el9_8 appstream
java-25-openjdk-crypto-adapter.x86_64 1:25.0.4.0.7-1.1.el9_8 appstream
java-25-openjdk-demo.x86_64 1:25.0.4.0.7-1.1.el9_8 appstream
java-25-openjdk-devel.x86_64 1:25.0.4.0.7-1.1.el9_8 appstream
java-25-openjdk-headless.x86_64 1:25.0.4.0.7-1.1.el9_8 appstream
java-25-openjdk-javadoc.x86_64 1:25.0.4.0.7-1.1.el9_8 appstream
java-25-openjdk-javadoc-zip.x86_64 1:25.0.4.0.7-1.1.el9_8 appstream
java-25-openjdk-jmods.x86_64 1:25.0.4.0.7-1.1.el9_8 appstream
java-25-openjdk-src.x86_64 1:25.0.4.0.7-1.1.el9_8 appstream
java-25-openjdk-static-libs.x86_64 1:25.0.4.0.7-1.1.el9_8 appstream
[root@rocky tmp]# dnf install --assumeyes java-25-openjdk.x86_64
::
::
root@rocky tmp]# which java
/usr/bin/java
[root@rocky tmp]# java --version
openjdk 25.0.4 2026-07-21 LTS
OpenJDK Runtime Environment (Red_Hat-25.0.4.0.7-1) (build 25.0.4+7-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-25.0.4.0.7-1) (build 25.0.4+7-LTS, mixed mode, sharing)
Liquibase installation:
[root@rocky tmp]# curl --location --remote-name https://github.com/liquibase/liquibase/releases/download/v5.0.3/liquibase-5.0.3.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 8505k 100 8505k 0 0 32.8M 0 --:--:-- --:--:-- --:--:-- 32.8M
[root@rocky tmp]# ls -l liquibase-5.0.3.tar.gz
-rw-r--r--. 1 root root 8709679 Aug 3 04:20 liquibase-5.0.3.tar.gz
[root@rocky tmp]# mkdir /opt/liquibase
[root@rocky tmp]# ls -ld /opt/liquibase
drwxr-xr-x. 2 root root 6 Aug 3 04:48 /opt/liquibase
[root@rocky tmp]# tar --directory=/opt/liquibase -zxvf /tmp/liquibase-5.0.3.tar.gz
ABOUT.txt
GETTING_STARTED.txt
LICENSE.txt
README.txt
UNINSTALL.txt
changelog.txt
examples/
examples/sql/
examples/sql/blank-changelog.sql
examples/sql/liquibase.properties
examples/sql/example-changelog.sql
examples/sql/example-changeset-sql.txt
examples/xml/
examples/xml/liquibase.properties
examples/xml/example-changeset-xml.txt
examples/xml/blank-changelog.xml
examples/xml/example-changelog.xml
examples/start-h2.bat
examples/json/
examples/json/example-changeset-json.txt
examples/json/example-changelog.json
examples/json/liquibase.properties
examples/json/blank-changelog.json
examples/yaml/
examples/yaml/liquibase.properties
examples/yaml/example-changeset-yaml.txt
examples/yaml/example-changelog.yaml
examples/yaml/blank-changelog.yaml
examples/start-h2
internal/
internal/lib/
internal/lib/commons-lang3.jar
internal/lib/opencsv.jar
internal/lib/liquibase-core.jar
internal/lib/picocli.jar
internal/lib/h2.jar
internal/lib/snakeyaml.jar
internal/lib/commons-collections4.jar
internal/lib/commons-io.jar
internal/lib/commons-text.jar
lib/
lib/README.txt
lib/liquibase_autocomplete_mac.bash
lib/liquibase_autocomplete.zsh
lib/liquibase_autocomplete.sh
licenses/
licenses/oss/
licenses/oss/gpl-2.0-classpath-exception.txt
licenses/oss/usage-data.txt
licenses/oss/README.txt
licenses/oss/apache-2.0.txt
licenses/oss/epl-2.0.txt
licenses/oss/FSL-1.1-ALv2.txt
liquibase
liquibase.bat
[root@rocky tmp]# ls -l /opt/liquibase
-rw-r--r--. 1 1001 1001 50 May 14 16:12 ABOUT.txt
-rw-r--r--. 1 1001 1001 466775 May 14 16:12 changelog.txt
drwxr-xr-x. 6 1001 1001 88 May 14 16:12 examples
-rw-r--r--. 1 1001 1001 11088 May 14 16:12 GETTING_STARTED.txt
drwxr-xr-x. 3 1001 1001 17 May 14 16:12 internal
drwxr-xr-x. 2 1001 1001 130 May 14 16:12 lib
drwxr-xr-x. 3 1001 1001 17 May 13 19:11 licenses
-rw-r--r--. 1 1001 1001 3688 May 14 16:12 LICENSE.txt
-rwxr-xr-x. 1 1001 1001 2655 May 13 19:11 liquibase ---executable
-rw-r--r--. 1 1001 1001 3247 May 13 19:11 liquibase.bat
-rw-r--r--. 1 1001 1001 3566 May 14 16:12 README.txt
-rw-r--r--. 1 1001 1001 738 May 14 16:12 UNINSTALL.txt
[root@rocky tmp]# chown -R root:root /opt/liquibase
[root@rocky tmp]# /opt/liquibase/liquibase --version
####################################################
## _ _ _ _ ##
## | | (_) (_) | ##
## | | _ __ _ _ _ _| |__ __ _ ___ ___ ##
## | | | |/ _` | | | | | '_ \ / _` / __|/ _ \ ##
## | |___| | (_| | |_| | | |_) | (_| \__ \ __/ ##
## \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___| ##
## | | ##
## |_| ##
## ##
## Get documentation at docs.liquibase.com ##
## Get certified courses at learn.liquibase.com ##
## ##
####################################################
Starting Liquibase at 04:53:51 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Home: /opt/liquibase
Java Home /usr/lib/jvm/java-25-openjdk (Version 25.0.4)
Libraries:
- internal/lib/commons-collections4.jar: Apache Commons Collections 4.5.0 By The Apache Software Foundation
- internal/lib/commons-io.jar: Apache Commons IO 2.22.0 By The Apache Software Foundation
- internal/lib/commons-lang3.jar: Apache Commons Lang 3.20.0 By The Apache Software Foundation
- internal/lib/commons-text.jar: Apache Commons Text 1.15.0 By The Apache Software Foundation
- internal/lib/h2.jar: H2 Database Engine 2.4.240 By H2 Group
- internal/lib/opencsv.jar: opencsv 5.12.0
- internal/lib/picocli.jar: picocli 4.7.7 By Remko Popma
- internal/lib/snakeyaml.jar: SnakeYAML 2.6.0
Liquibase Version: 5.0.3
Liquibade working with PostgreSQL:
#
# create an OS user:
#
[root@rocky tmp]# useradd --home-dir /home/kmaau --create-home --shell /bin/bash kmaau
[root@rocky tmp]# grep kmaau /etc/group /etc/passwd
/etc/group:kmaau:x:1001:
/etc/passwd:kmaau:x:1001:1001::/home/kmaau:/bin/bash
[root@rocky tmp]# id -a kmaau
uid=1001(kmaau) gid=1001(kmaau) groups=1001(kmaau)
[root@rocky tmp]# su - kmaau
[kmaau@rocky ~]$ whoami
kmaau
[kmaau@rocky ~]$ vi ${HOME}/.bash_profile
::
::
[kmaau@rocky ~]$ cat ${HOME}/.bash_profile
[[blue:# .bash_profile]]
[[blue:]]
[[blue:## Get the aliases and functions]]
[[blue:if [ -f ~/.bashrc ]; then]]
[[blue: . ~/.bashrc]]
[[blue:fi]]
[[blue:## User specific environment and startup programs]]
[[blue:export LIQUIBASE_SHOW_BANNER=false]]
[[blue:export PATH=${PATH}:/opt/liquibase]] ---set ${PATH}
[kmaau@rocky ~]$ source ${HOME}/.bash_profile
[kmaau@rocky ~]$ which liquibase
/opt/liquibase/liquibase
[kmaau@rocky liquibase-postgres]$ liquibase --version
Starting Liquibase at 05:23:24 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Home: /opt/liquibase
Java Home /usr/lib/jvm/java-25-openjdk (Version 25.0.4)
Libraries:
- /home/kmaau/liquibase-postgres/postgresql-42.7.13.jar: PostgreSQL JDBC Driver 42.7.13 By PostgreSQL Global Development Group
- internal/lib/commons-collections4.jar: Apache Commons Collections 4.5.0 By The Apache Software Foundation
- internal/lib/commons-io.jar: Apache Commons IO 2.22.0 By The Apache Software Foundation
- internal/lib/commons-lang3.jar: Apache Commons Lang 3.20.0 By The Apache Software Foundation
- internal/lib/commons-text.jar: Apache Commons Text 1.15.0 By The Apache Software Foundation
- internal/lib/h2.jar: H2 Database Engine 2.4.240 By H2 Group
- internal/lib/opencsv.jar: opencsv 5.12.0
- internal/lib/picocli.jar: picocli 4.7.7 By Remko Popma
- internal/lib/snakeyaml.jar: SnakeYAML 2.6.0
Liquibase Version: 5.0.3
#
# download PostgreSQL JDBC driver from https://jdbc.postgresql.org/download:
#
[kmaau@rocky ~]$ mkdir ${HOME}/liquibase-postgres
[kmaau@rocky ~]$ ls -ld ${HOME}/liquibase-postgres
drwxr-xr-x. 2 kmaau kmaau 6 Aug 3 01:12 /home/kmaau/liquibase-postgres ---liquibase working directory
[kmaau@rocky ~]$ cd ${HOME}/liquibase-postgres
[kmaau@rocky liquibase-postgres]$ curl --location --remote-name https://jdbc.postgresql.org/download/postgresql-42.7.13.jar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1192k 100 1192k 0 0 1842k 0 --:--:-- --:--:-- --:--:-- 1840k
[kmaau@rocky liquibase-postgres]$ ls -l postgresql-42.7.13.jar
-rw-r--r--. 1 kmaau kmaau 1220948 Aug 3 05:02 postgresql-42.7.13.jar
#
# configure Liquibase and PostgreSQL conection:
#
[kmaau@rocky liquibase-postgres]$ vi liquibase.properties
::
::
[kmaau@rocky liquibase-postgres]$ cat liquibase.properties
[[blue:changeLogFile=changelog.xml]]
[[blue:url=jdbc:postgresql://localhost:5432/liquibase_demo]]
[[blue:username=kmaau]]
[[blue:password=passw0rd]]
[[blue:classpath=postgresql-42.7.13.jar]]
#
# first ChangeSet:
#
[kmaau@rocky liquibase-postgres]$ vi changelog.xml
::
::
[kmaau@rocky liquibase-postgres]$ cat changelog.xml
[[blue:<?xml version="1.0" encoding="UTF-8"?>]]
[[blue:]]
[[blue:<databaseChangeLog]]
[[blue: xmlns="http://www.liquibase.org/xml/ns/dbchangelog"]]
[[blue: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"]]
[[blue: xsi:schemaLocation="]]
[[blue: http://www.liquibase.org/xml/ns/dbchangelog]]
[[blue: https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">]]
[[blue:]]
[[blue: <changeSet id="1" author="kmaau">]]
[[blue: <createTable tableName="users">]]
[[blue: <column name="id" type="INT">]]
[[blue: <constraints primaryKey="true"]]
[[blue: nullable="false"/>]]
[[blue: </column>]]
[[blue: <column name="name"]]
[[blue: type="VARCHAR(100)">]]
[[blue: <constraints nullable="false"/>]]
[[blue: </column>]]
[[blue: </createTable>]]
[[blue: </changeSet>]]
[[blue:]]
[[blue:</databaseChangeLog>]]
[kmaau@rocky liquibase-postgres]$ xmllint --noout changelog.xml
(....nothing!)
kmaau@rocky liquibase-postgres]$ liquibase validate
Starting Liquibase at 05:20:23 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Version: 5.0.3
No validation errors found.
Liquibase command 'validate' was executed successfully.
#
# apply the ChangeSet:
#
[kmaau@rocky liquibase-postgres]$ liquibase update
Starting Liquibase at 05:24:28 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Version: 5.0.3
Running Changeset: changelog.xml::1::kmaau
UPDATE SUMMARY
Run: 1
Previously run: 0
Filtered out: 0
-------------------------------
Total change sets: 1
Liquibase: Update has been successful. Rows affected: 0
Liquibase command 'update' was executed successfully.
[kmaau@rocky liquibase-postgres]$ psql --username=kmaau --dbname liquibase_demo
psql (18.4)
Type "help" for help.
liquibase_demo=> \dt
List of tables
Schema | Name | Type | Owner
--------+-----------------------+-------+-------
public | databasechangelog | table | kmaau
public | databasechangeloglock | table | kmaau
public | users | table | kmaau ---this!
(3 rows)
liquibase_demo=> \d users;
Table "public.users"
Column | Type | Collation | Nullable | Default
--------+------------------------+-----------+----------+---------
id | integer | | not null |
name | character varying(100) | | not null |
Indexes:
"users_pkey" PRIMARY KEY, btree (id)
liquibase_demo=> \x
Expanded display is on.
liquibase_demo=> SELECT * FROM databasechangelog;
-[ RECORD 1 ]-+-----------------------------------
id | 1
author | kmaau
filename | changelog.xml
dateexecuted | 2026-08-03 05:24:33.496195
orderexecuted | 1
exectype | EXECUTED
md5sum | 9:9bc46165fbef19c955e92518132c04cd
description | createTable tableName=users
comments |
tag |
liquibase | 5.0.3
contexts |
labels |
deployment_id | 5734667028
liquibase_demo=> \q
#
# add a new column:
#
[kmaau@rocky liquibase-postgres]$ cp changelog.xml changelog.one
[kmaau@rocky liquibase-postgres]$ vi changelog.xml
::
::
[kmaau@rocky liquibase-postgres]$ cat changelog.xml
[[blue:<?xml version="1.0" encoding="UTF-8"?>]]
[[blue:]]
[[blue:<databaseChangeLog]]
[[blue: xmlns="http://www.liquibase.org/xml/ns/dbchangelog"]]
[[blue: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"]]
[[blue: xsi:schemaLocation="]]
[[blue: http://www.liquibase.org/xml/ns/dbchangelog]]
[[blue: https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">]]
[[blue:]]
[[blue: <changeSet id="2" author="kmaau">]]
[[blue: <addColumn tableName="users">]]
[[blue: <column name="email"]]
[[blue: type="VARCHAR(255)"/>]]
[[blue: </addColumn>]]
[[blue: </changeSet>]]
[[blue:]]
[[blue:</databaseChangeLog>]]
[kmaau@rocky liquibase-postgres]$ liquibase validate
Starting Liquibase at 05:40:45 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Version: 5.0.3
No validation errors found.
Liquibase command 'validate' was executed successfully.
[kmaau@rocky liquibase-postgres]$ liquibase update
Starting Liquibase at 05:40:57 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Version: 5.0.3
Running Changeset: changelog.xml::2::kmaau
UPDATE SUMMARY
Run: 1
Previously run: 0
Filtered out: 0
-------------------------------
Total change sets: 1
Liquibase: Update has been successful. Rows affected: 0
Liquibase command 'update' was executed successfully.
[kmaau@rocky liquibase-postgres]$ psql --username=kmaau --dbname liquibase_demo
psql (18.4)
Type "help" for help.
liquibase_demo=> \d users;
Table "public.users"
Column | Type | Collation | Nullable | Default
--------+------------------------+-----------+----------+---------
id | integer | | not null |
name | character varying(100) | | not null |
email | character varying(255) | | | ---this!
Indexes:
"users_pkey" PRIMARY KEY, btree (id)
liquibase_demo=> \q
#
# insert seed data:
#
[kmaau@rocky liquibase-postgres]$ cp changelog.xml changelog.two
[kmaau@rocky liquibase-postgres]$ vi changelog.xml
::
::
[kmaau@rocky liquibase-postgres]$ cat changelog.xml
[[blue:<?xml version="1.0" encoding="UTF-8"?>]]
[[blue:]]
[[blue:<databaseChangeLog]]
[[blue: xmlns="http://www.liquibase.org/xml/ns/dbchangelog"]]
[[blue: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"]]
[[blue: xsi:schemaLocation="]]
[[blue: http://www.liquibase.org/xml/ns/dbchangelog]]
[[blue: https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">]]
[[blue:]]
[[blue: <changeSet id="3" author="kmaau">]]
[[blue: <insert tableName="users">]]
[[blue: <column name="id" valueNumeric="1"/>]]
[[blue: <column name="name" value="Kian"/>]]
[[blue: <column name="email" value="kian@test.com"/>]]
[[blue: </insert>]]
[[blue: </changeSet>]]
[[blue:]]
[[blue:</databaseChangeLog>]]
[kmaau@rocky liquibase-postgres]$ liquibase validate
Starting Liquibase at 05:48:06 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Version: 5.0.3
No validation errors found.
Liquibase command 'validate' was executed successfully.
[kmaau@rocky liquibase-postgres]$ liquibase update
Starting Liquibase at 05:48:39 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Version: 5.0.3
Running Changeset: changelog.xml::3::kmaau
UPDATE SUMMARY
Run: 1
Previously run: 0
Filtered out: 0
-------------------------------
Total change sets: 1
Liquibase: Update has been successful. Rows affected: 1
Liquibase command 'update' was executed successfully.
[kmaau@rocky liquibase-postgres]$ psql --username=kmaau --dbname liquibase_demo --command "SELECT * FROM users;"
id | name | email
----+------+---------------
1 | Kian | kian@test.com
(1 row)
#
# rollback:
#
[kmaau@rocky liquibase-postgres]$ cp changelog.xml changelog.three
[kmaau@rocky liquibase-postgres]$ vi changelog.xml
::
::
[kmaau@rocky liquibase-postgres]$ cat changelog.xml
[[blue:<?xml version="1.0" encoding="UTF-8"?>]]
[[blue:]]
[[blue:<databaseChangeLog]]
[[blue: xmlns="http://www.liquibase.org/xml/ns/dbchangelog"]]
[[blue: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"]]
[[blue: xsi:schemaLocation="]]
[[blue: http://www.liquibase.org/xml/ns/dbchangelog]]
[[blue: https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">]]
[[blue:]]
[[blue: <changeSet id="4" author="kmaau">]]
[[blue: <createTable tableName="products">]]
[[blue: <column name="id" type="INT">]]
[[blue: <constraints primaryKey="true"/>]]
[[blue: </column>]]
[[blue: <column name="name" type="VARCHAR(100)"/>]]
[[blue: </createTable>]]
[[blue: <rollback>]]
[[blue: <dropTable tableName="products"/>]]
[[blue: </rollback>]]
[[blue: </changeSet>]]
[[blue:]]
[[blue:</databaseChangeLog>]]
[kmaau@rocky liquibase-postgres]$ liquibase validate
Starting Liquibase at 05:53:58 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Version: 5.0.3
No validation errors found.
Liquibase command 'validate' was executed successfully.
[kmaau@rocky liquibase-postgres]$ liquibase update
Starting Liquibase at 05:54:23 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Version: 5.0.3
Running Changeset: changelog.xml::4::kmaau
UPDATE SUMMARY
Run: 1
Previously run: 0
Filtered out: 0
-------------------------------
Total change sets: 1
Liquibase: Update has been successful. Rows affected: 0
Liquibase command 'update' was executed successfully.
[kmaau@rocky liquibase-postgres]$ psql --username=kmaau --dbname liquibase_demo --command "\dt;"
List of tables
Schema | Name | Type | Owner
--------+-----------------------+-------+-------
public | databasechangelog | table | kmaau
public | databasechangeloglock | table | kmaau
public | products | table | kmaau ---add a table
public | users | table | kmaau
(4 rows)
[kmaau@rocky liquibase-postgres]$ liquibase rollback-count 1
Starting Liquibase at 05:58:02 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Version: 5.0.3
Rolling Back Changeset: changelog.xml::4::kmaau
Liquibase command 'rollback-count' was executed successfully.
[kmaau@rocky liquibase-postgres]$ psql --username=kmaau --dbname liquibase_demo --command "\dt;"
List of tables
Schema | Name | Type | Owner ---rollback: drop table "products"
--------+-----------------------+-------+-------
public | databasechangelog | table | kmaau
public | databasechangeloglock | table | kmaau
public | users | table | kmaau
(3 rows)
#
# generate SQL without applying:
#
[kmaau@rocky liquibase-postgres]$ liquibase updateSQL
Starting Liquibase at 06:01:09 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Version: 5.0.3
-- Lock Database
UPDATE public.databasechangeloglock SET LOCKED = TRUE, LOCKEDBY = 'rocky (10.137.0.6)', LOCKGRANTED = NOW() WHERE ID = 1 AND LOCKED = FALSE;
-- *********************************************************************
-- Update Database Script
-- *********************************************************************
-- Change Log: changelog.xml
-- Ran at: 8/3/26, 6:01 AM
-- Against: kmaau@jdbc:postgresql://localhost:5432/liquibase_demo
-- Liquibase version: 5.0.3
-- *********************************************************************
-- Changeset changelog.xml::4::kmaau
CREATE TABLE public.products (id INTEGER NOT NULL, name VARCHAR(100), CONSTRAINT products_pkey PRIMARY KEY (id));
INSERT INTO public.databasechangelog (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS,
LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('4', 'kmaau', 'changelog.xml', NOW(), 4, '9:979e55ee59940199c9847597e7ffb10f',
'createTable tableName=products', '', 'EXECUTED', NULL, NULL, '5.0.3', '5736867290');
-- Release Database Lock
UPDATE public.databasechangeloglock SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;
Liquibase command 'updateSql' was executed successfully.
#
# liquibase status:
#
[kmaau@rocky liquibase-postgres]$ liquibase status
Starting Liquibase at 06:05:58 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Version: 5.0.3
1 changeset has not been applied to kmaau@jdbc:postgresql://localhost:5432/liquibase_demo
changelog.xml::4::kmaau
Liquibase command 'status' was executed successfully.
#
# liquibase history:
#
[kmaau@rocky liquibase-postgres]$ liquibase history
Starting Liquibase at 06:06:28 using Java 25.0.4 (version 5.0.3 #10665 built at 2026-05-13 17:55+0000)
Liquibase Version: 5.0.3
Liquibase History for jdbc:postgresql://localhost:5432/liquibase_demo
+---------------+-----------------+----------------+------------------+--------------+-----+
| Deployment ID | Update Date | Changelog Path | Changeset Author | Changeset ID | Tag |
+---------------+-----------------+----------------+------------------+--------------+-----+
| 5734667028 | 8/3/26, 5:24 AM | changelog.xml | kmaau | 1 | |
+---------------+-----------------+----------------+------------------+--------------+-----+
+---------------+-----------------+----------------+------------------+--------------+-----+
| Deployment ID | Update Date | Changelog Path | Changeset Author | Changeset ID | Tag |
+---------------+-----------------+----------------+------------------+--------------+-----+
| 5735655619 | 8/3/26, 5:41 AM | changelog.xml | kmaau | 2 | |
+---------------+-----------------+----------------+------------------+--------------+-----+
+---------------+-----------------+----------------+------------------+--------------+-----+
| Deployment ID | Update Date | Changelog Path | Changeset Author | Changeset ID | Tag |
+---------------+-----------------+----------------+------------------+--------------+-----+
| 5736117894 | 8/3/26, 5:48 AM | changelog.xml | kmaau | 3 | |
+---------------+-----------------+----------------+------------------+--------------+-----+
Liquibase command 'history' was executed successfully.
Sample of multi-file Changelogs:
db/
├── changelog.xml
├── changes
│ ├── 001-users.xml
│ ├── 002-orders.xml
│ └── 003-products.xml
[kmaau@rocky db]$ cat changelog.xml
::
::
::
[[blue:<databaseChangeLog>]]
[[blue: <include file="changes/001-users.xml"/>]]
[[blue: <include file="changes/002-orders.xml"/>]]
[[blue: <include file="changes/003-products.xml"/>]]
[[blue:</databaseChangeLog>]]
::
::