pgAdmin 4 is the official, full-featured web-based administration and development platform for PostgreSQL. It provides a graphical interface for managing databases, schemas, tables, views, functions, roles, and server connections; a SQL query editor with syntax highlighting and query execution plans; a visual schema designer; backup and restore wizards; and monitoring dashboards for server statistics. pgAdmin 4 can be deployed as a desktop application or as a web server accessible via a browser, making it suitable for both local development and remote PostgreSQL administration. It is not available in RHEL 9’s AppStream and must be installed from the official PostgreSQL/pgAdmin repository. This guide covers installing pgAdmin 4 in web mode on RHEL 9 with Nginx as a reverse proxy.

Prerequisites

  • PostgreSQL installed on RHEL 9
  • Nginx installed
  • Python 3.9+ (included in RHEL 9)

Step 1 — Add the pgAdmin Repository

# Install the pgAdmin4 repo
rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-2-1.noarch.rpm
dnf install -y pgadmin4-web

Step 2 — Run the Setup Script

# This creates the initial admin account and configures the web app
/usr/pgadmin4/bin/setup-web.sh

# Prompts:
# - Email address for initial admin (e.g. [email protected])
# - Password for admin account
# - Confirm web server integration (Apache is default — we'll use Nginx)

Step 3 — Configure Nginx Reverse Proxy for pgAdmin 4

# pgAdmin 4 web runs as a Python WSGI app — configure Nginx to proxy to it
# pgAdmin listens on a uWSGI socket after configuration

# /etc/nginx/conf.d/pgadmin4.conf
server {
    listen      443 ssl http2;
    server_name pgadmin.example.com;

    ssl_certificate     /etc/letsencrypt/live/pgadmin.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/pgadmin.example.com/privkey.pem;

    # Restrict to trusted IPs only
    allow 203.0.113.0/24;
    deny all;

    location /pgadmin4/ {
        proxy_pass         http://unix:/run/pgadmin4/pgadmin4.sock;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_redirect     off;
    }
}
nginx -t && systemctl reload nginx

Step 4 — Start and Enable pgAdmin 4

systemctl enable --now pgadmin4
systemctl status pgadmin4

Step 5 — Connect to a PostgreSQL Server in pgAdmin 4

  1. Browse to https://pgadmin.example.com/pgadmin4/
  2. Log in with the email and password set during setup
  3. Right-click ServersRegister → Server
  4. In the General tab: enter a Name (e.g., Local PostgreSQL)
  5. In the Connection tab: Host 127.0.0.1, Port 5432, Username myapp_user
  6. Click Save

Step 6 — Set SELinux Permissions

# Allow Nginx to connect to the pgAdmin socket
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1

Conclusion

pgAdmin 4 on RHEL 9 with Nginx provides a comprehensive, browser-accessible PostgreSQL management interface. Restricting access by source IP at the Nginx level and serving over HTTPS only are minimum security requirements for any deployment accessible over a network. For local development use, the pgAdmin 4 desktop application is a simpler alternative that doesn’t require a web server configuration.

Next steps: How to Secure MySQL on RHEL 9, How to Install phpMyAdmin on RHEL 9, and How to Configure PostgreSQL Remote Access and SSL on RHEL 9.