Skip to main content

How To Install pgAdmin on AlmaLinux 9 and Rocky Linux 9

Updated this week

pgAdmin 4 is a web-based management tool for PostgreSQL. This guide explains how to install and configure pgAdmin 4 on AlmaLinux 9 and Rocky Linux 9.

Prerequisites

Make sure the Apache web server is installed enabled.

1. Install Required Utilities

Before installing pgAdmin 4, install yum-utils:

dnf install yum-utils -y

2. Add pgAdmin 4 Repository

Download and install the official pgAdmin 4 repository:

rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-2-1.noarch.rpm

3. Update System Packages

Run an update to refresh the package list:

dnf update -y

4. Install pgAdmin 4

Now install pgAdmin 4:

dnf install pgadmin4 -y

5. Configure pgAdmin 4 Web Mode

Run the pgAdmin 4 web setup script:

/usr/pgadmin4/bin/setup-web.sh

During this step, you will be prompted to:

  • Set up an email address as the administrator login.

  • Choose and confirm an admin password.

6. Open Firewall Ports

IPtables:

Allow HTTP (port 80) and HTTPS (port 443) traffic if they are not open yet:

iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 443 -j ACCEPT

Save changes:

iptables-save | sudo tee /etc/sysconfig/iptables

Restart iptables:

systemctl restart iptables

Firewalld:

If you are using firewalld, run these commands to allow HTTP and HTTPS:

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload

7. Adjust SELinux (if enabled)

If SELinux is in enforcing mode, you will not be able to access pgAdmin after installation.

You can check SELinux status by running this command:

getenforce

If it returns Disabled, then SELinux is turned off, and you can install pgAdmin.

If the status is Enforcing, it means SELinux is enabled and actively enforcing its policies.

Permissive – SELinux is enabled but only logs violations instead of enforcing them. You can keep it as permissive and install pgAdmin.

So if the status "Enforcing" you need to change to permissive:

nano /etc/selinux/config

Find the line:

SELINUX=enforcing

Change "enforcing" to "permissive".

Save file and exit.

Next, reboot:

reboot

8. Access pgAdmin 4

Now you can access pgAdmin 4 in a web browser using your server's IP address:

http://server-ip/pgadmin4

Replace server-ip with your actual server's IP address.

You will see the "login" page. Enter the email address and password that you specified during the installation process.

Next, you will the pgAdmin dashboard:

Did this answer your question?