PostgreSQL 19 Beta 1 was released on June 4, 2026, with expected GA release in September–October 2026. As a DevOps engineer building SaaS solutions and blogging platforms, you need the latest database features for performance, security, and scalability. PostgreSQL 19 introduces parallel autovacuum, auto-scaling I/O workers, SQL/PGQ Property Graph Queries, and up to 2× faster inserts with FK checks.
This guide covers installation on Ubuntu 22.04/24.04, Debian, Rocky Linux 9, and AlmaLinux 9 with CLI commands, security configuration, and automation tips.
⚠️ Important Notes Before Installation
JITDisabled by default (SET jit = on;) TOAST CompressionChanged from pglz to lz4 Data ChecksumsEnabled by default for new clusters Test EnvironmentUbuntu 24.04 (Noble) on WSL2
Part 1: Install PostgreSQL 19 on Ubuntu 22.04 & 24.04
Step 1: Install PostgreSQL Common and Add Repository
# Install postgresql-common package sudo apt install -y postgresql-common # Run the PostgreSQL repository setup script sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
This script automatically adds the PGDG (PostgreSQL Global Development Group) APT repository.
Step 2: Install PostgreSQL 19
# Update package list sudo apt update # Install PostgreSQL 19 sudo apt install -y postgresql-19
Step 3: Verify Installation
# Check PostgreSQL version /usr/lib/postgresql/19/bin/postgres --version # Verify service status sudo systemctl status postgresql
Expected output: postgres 19.0beta1
Step 4: Initialize and Enable Service
# Enable PostgreSQL to start on boot sudo systemctl enable postgresql # Start PostgreSQL service sudo systemctl start postgresql
Part 2: Install PostgreSQL 19 on Debian
Step 1: Add PostgreSQL GPG Key
# Create keyring directory sudo install -d /usr/share/keyrings # Download and install PostgreSQL GPG key curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /usr/share/keyrings/postgresql-keyring.gpg
Step 2: Add PostgreSQL Repository
# Get Debian version codename
. /etc/os-release
# Add PostgreSQL repository (adjust codename for your version)
echo "deb [signed-by=/usr/share/keyrings/postgresql-keyring.gpg] http://apt.postgresql.org/pub/repos/apt/${VERSION_CODENAME}-pgdg main" | sudo tee /etc/apt/sources.list.d/postgresql.list
Step 3: Install PostgreSQL 19
# Update package list sudo apt update # Install PostgreSQL 19 sudo apt install -y postgresql-19 postgresql-contrib-19
Step 4: Verify and Enable Service
# Check version /usr/lib/postgresql/19/bin/postgres --version # Enable and start service sudo systemctl enable postgresql sudo systemctl start postgresql
Part 3: Install PostgreSQL 19 on Rocky Linux 9 & AlmaLinux 9
Step 1: Install PostgreSQL REPORPMS Repository
# Install PGDG Red Hat repository RPM sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
This adds the official PostgreSQL YUM repository for Rocky/AlmaLinux 9.
Step 2: Install PostgreSQL 19
# Update package index sudo dnf update -y # Install PostgreSQL 19 server and client sudo dnf install -y postgresql19-server postgresql19-contrib postgresql19
Note: Package names use postgresql19 prefix (not postgresql-19) on RHEL-family systems.
Step 3: Initialize the Database
# Initialize PostgreSQL database cluster sudo postgresql-setup --initdb
Step 4: Enable and Start Service
# Enable PostgreSQL to start on boot sudo systemctl enable postgresql # Start PostgreSQL service sudo systemctl start postgresql # Check service status sudo systemctl status postgresql
Step 5: Verify Installation
# Check PostgreSQL version /usr/pgsql-19/bin/postgres --version
Part 4: Post-Installation Configuration
Create PostgreSQL User and Set Password
# Switch to postgres user sudo -i -u postgres # Connect to PostgreSQL shell psql # Inside psql, set password for postgres user ALTER USER postgres PASSWORD 'your_secure_password'; # Exit psql \q
Configure PostgreSQL to Listen on All Interfaces
File locations:
- Ubuntu/Debian:
/etc/postgresql/19/main/postgresql.conf - Rocky/Alma:
/var/lib/pgsql/19/data/postgresql.conf
# Edit postgresql.conf sudo nano /etc/postgresql/19/main/postgresql.conf # Find and modify these lines: # change from: listen_addresses = 'localhost' listen_addresses = '*' # change from: port = 5472 (or other) port = 5432
Configure pg_hba.conf for Authentication
File locations:
- Ubuntu/Debian:
/etc/postgresql/19/main/pg_hba.conf - Rocky/Alma:
/var/lib/pgsql/19/data/pg_hba.conf
# Edit pg_hba.conf sudo nano /etc/postgresql/19/main/pg_hba.conf # Add this line for remote access (MD5 authentication): host all all 0.0.0.0/0 md5 # Or for safer local-only access: host all all 127.0.0.1/32 md5 host all all ::1/128 md5
Restart PostgreSQL Service
# Restart to apply configuration changes sudo systemctl restart postgresql # Verify service is running sudo systemctl status postgresql
Part 5: Security Hardening for PostgreSQL 19
1. Enable Firewall Rules
# Ubuntu/Debian with UFW sudo ufw allow 5432/tcp # Rocky/Alma with firewalld sudo firewall-cmd --permanent --add-port=5432/tcp sudo firewall-cmd --reload
2. Set Up Fail2Ban for PostgreSQL
# Install Fail2Ban sudo apt install fail2ban # Ubuntu/Debian sudo dnf install fail2ban # Rocky/Alma # Create PostgreSQL Fail2Ban config sudo nano /etc/fail2ban/jail.d/postgresql.conf text [postgresql] enabled = true port = 5432 filter = postgresql logpath = /var/log/postgresql/postgresql-19-main.log maxretry = 3
3. Enable Audit Logging
# Edit postgresql.conf sudo nano /etc/postgresql/19/main/postgresql.conf # Add these lines: log_statement = 'all' log_connections = on log_disconnections = on
Part 6: Automate PostgreSQL Installation with Ansible
Create an Ansible playbook for multi-server deployment:
# postgresql19-install.yml
- name: Install PostgreSQL 19
hosts: databases
become: true
tasks:
- name: Ubuntu/Debian - Add PostgreSQL repository
apt:
deb: http://apt.postgresql.org/pub/repos/apt/$(lsb_release -cs)-pgdg/main/postgresql-19
when: "ansible_os_family == 'Debian'"
- name: Rocky/Alma - Install PGDG repository
dnf:
name: https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
state: present
when: "ansible_os_family == 'RedHat'"
- name: Install PostgreSQL 19
apt:
name: postgresql-19
state: present
when: "ansible_os_family == 'Debian'"
- name: Install PostgreSQL 19 (RHEL)
dnf:
name: postgresql19-server
state: present
when: "ansible_os_family == 'RedHat'"
- name: Enable and start PostgreSQL service
systemd:
name: postgresql
enabled: true
state: started
Run it:
ansible-playbook postgresql19-install.yml
Part 7: Create Database and Test Connection
# Switch to postgres user sudo -i -u postgres # Create new database createDB myapp_db # Create new user createuser --password myapp_user # Grant privileges psql -c "GRANT ALL PRIVILEGES ON DATABASE myapp_db TO myapp_user;" # Test connection psql -U myapp_user -d myapp_db -h localhost
Troubleshooting Common Issues
IssueSolutionService not startingCheck logs: sudo tail -f /var/log/postgresql/postgresql-19-main.logPermission deniedVerify pg_hba.conf allows your IPPort 5432 unavailableCheck with sudo ss -tuln | grep 5432Repository not foundEnsure GPG key is installed correctlyJIT disabledSet SET jit = on; in session or postgresql.conf
Final Thoughts
PostgreSQL 19 Beta 1 brings significant performance improvements, new developer features, and enhanced security. As a DevOps engineer managing multiple servers, automating installation with Ansible and hardening with firewall rules is essential for production deployments.

