pgAdmin 4 is the official open-source administration and development platform for PostgreSQL, providing a rich web interface for managing databases, running queries, monitoring activity, and visualizing schemas. On RHEL 8, the recommended installation path is the official PostgreSQL Global Development Group (PGDG) repository, which ships pgAdmin 4 as a dedicated web application package with a setup wizard that handles the Apache configuration automatically. This tutorial installs pgAdmin 4 in web mode on a RHEL 8 server, walks through the setup script, and shows how to connect to a PostgreSQL instance from the browser.
Prerequisites
- A RHEL 8 server with a non-root sudo user
- PostgreSQL installed and running (version 13 or later recommended)
- Apache (httpd) installed and running
- Python 3.6 or later available (included in RHEL 8 AppStream)
- The PGDG repository enabled (installed in Step 1)
- firewalld configured to allow HTTP/HTTPS traffic
Step 1 — Install the PostgreSQL PGDG Repository
The PGDG repository provides up-to-date PostgreSQL packages and pgAdmin 4 for RHEL 8. Install the repository RPM first, then disable the built-in PostgreSQL module to prevent conflicts with PGDG packages.
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf -qy module disable postgresql
Step 2 — Install pgAdmin 4
Install the pgadmin4-web package, which includes the web application, Python dependencies, and the Apache configuration template. The pgadmin4-server package is pulled in automatically as a dependency.
sudo dnf install -y pgadmin4-web
Confirm the installed version:
rpm -q pgadmin4-web
Step 3 — Run the pgAdmin Setup Script
The setup script creates the pgAdmin application database, sets up the initial admin account, and writes the Apache alias configuration to /etc/httpd/conf.d/pgadmin4.conf. Run it as root and follow the prompts.
sudo /usr/pgadmin4/bin/setup-web.sh
You will be prompted to enter an email address and password for the pgAdmin admin account:
Setting up pgAdmin 4 in web mode on a Debian based platform...
Creating configuration database...
NOTE: Configuring authentication for SERVER mode.
Enter the email address and password to use for the initial pgAdmin user account:
Email address: [email protected]
Password: **********************
Retype password: **********************
pgAdmin 4 - Application Initialisation
======================================
Creating storage and log directories...
Configuring SELinux...
The Apache web server is running and must be restarted for the pgAdmin 4 installation to complete. Continue (y/n)? y
Apache successfully restarted. You can now start using pgAdmin 4 in web mode at http://127.0.0.1/pgadmin4
The script also applies the necessary SELinux file contexts and restarts Apache automatically.
Step 4 — Verify the Apache Configuration
Inspect the generated Apache alias configuration to understand how requests to /pgadmin4 are proxied to the Python WSGI application.
cat /etc/httpd/conf.d/pgadmin4.conf
The file contains a WSGIDaemonProcess directive and an Alias /pgadmin4 mapping. If you need to restrict access by IP, add a <Location /pgadmin4> block:
sudo nano /etc/httpd/conf.d/pgadmin4.conf
Require ip 127.0.0.1
Require ip 203.0.113.50
sudo systemctl restart httpd
Step 5 — Open the Firewall and Access the Web UI
If the pgAdmin server will be accessed remotely, allow HTTP (and optionally HTTPS) through firewalld:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
Open a browser and navigate to:
http://your_server_ip/pgadmin4
Log in with the email address and password you provided during setup. The pgAdmin 4 dashboard will load, showing the browser panel on the left and a welcome tab in the main area.
Step 6 — Add a PostgreSQL Server Connection
To manage a PostgreSQL instance, register it as a server in pgAdmin. Click Add New Server on the dashboard (or right-click Servers in the browser panel and choose Register → Server). On the General tab enter a display name, then switch to the Connection tab and fill in the connection details:
Host name/address : 127.0.0.1
Port : 5432
Maintenance DB : postgres
Username : postgres
Password : your_postgres_password
Save password? : Yes (toggle on)
Click Save. pgAdmin will connect immediately and display the server tree — databases, schemas, tables, roles, and tablespaces — in the left panel. You can now run queries using the Query Tool, view table data, inspect execution plans, and manage roles without leaving the browser.
Conclusion
You have installed pgAdmin 4 on RHEL 8 from the official PGDG repository, run the setup wizard to create the admin account and configure Apache, restricted access by IP address, and connected to a PostgreSQL server from the web interface. pgAdmin 4 provides a powerful visual layer over PostgreSQL, making routine tasks such as schema browsing, query development, and user management significantly faster than working from the command line alone.
Next steps: How to Install and Configure PostgreSQL 16 on RHEL 8, How to Back Up and Restore PostgreSQL Databases on RHEL 8, and How to Configure PostgreSQL Streaming Replication on RHEL 8.