Install and Use pgAdmin 4 on Rocky Linux 8|AlmaLinux 8

Posted on 36 views

PgAdmin is an open-source and widely used frontend management tool for the PostgreSQL database system developed in Python language. It allows one to manage the PostgreSQL database from the web interface by providing all the required features.

This release version PgAdmin 4 replaces the previous version PgAdmin 3 which was written in C++ language with support for PostgreSQL up to version 9.2. pgAdmin 4 comes with the following amazing features:

  • A live SQL Query Tool with direct data editing
  • A syntax-highlighting SQL editor
  • Supportive error messages
  • Helpful hints
  • Has support for administrative queries
  • A redesigned graphical interface
  • Online help and information about using pgAdmin dialogs and tools.
  • Responsive, context-sensitive behavior
  • Auto-detection and support for objects discovered at run-time

In this guide, we will systematically walk through how to install and use pgAdmin 4 on Rocky Linux 8 | AlmaLinux 8.

Setup Pre-requisites

Before we proceed, you will require to have PostgreSQL installed on your Rocky Linux 8 | AlmaLinux 8 with the aid of this guide

You will also need a superuser account created. Login to the PostgreSQL shell.

sudo -u postgres psql

Now create a superuser to be used to connect and manage other users and databases.

postgres-# \q

Install pgAdmin 4 on Rocky Linux 8 | AlmaLinux 8

Now with PostgreSQL installed, proceed and install PgAdmin 4 using the steps below.

Step 1 – Add the PgAdmin4 Repository on Rocky Linux| AlmaLinux 8

We first need to add the pgAdmin YUM repository to our system to be able to install this latest pgAdmin version.

Install the required package

sudo dnf install yum-utils

Then disable the PostgreSQL common repositories to allow us to grab the latest PgAdmin 4 packages from the PgAdmin repositories.

sudo yum-config-manager --disable pgdg-common

Now add the pgAdmin 4 repositories to our Rocky Linux| AlmaLinux 8 with the command:

sudo rpm -i

Update your package index.

sudo dnf update

Step 2 – Install PgAdmin 4 on Rocky Linux |AlmaLinux 8

Now with the repositories added, installing pgAdmin 4 is as easy as robbing a child’s bank. Simply use the command below to install PgAdmin 4 on Rocky Linux |AlmaLinux 8.

sudo dnf install pgadmin4

Dependency Tree:

Dependencies resolved.
 Package           Arch   Version                               Repo       Size
 pgadmin4          noarch 6.1-1.el8                             pgAdmin4  6.2 k
Installing dependencies:
 apr               x86_64 1.6.3-11.el8.1                        appstream 124 k
 apr-util          x86_64 1.6.1-6.el8.1                         appstream 104 k
 httpd             x86_64 2.4.37-39.module+el8.4.0+655+f2bfd6ee.1
                                                                appstream 1.4 M
 httpd-filesystem  noarch 2.4.37-39.module+el8.4.0+655+f2bfd6ee.1
                                                                appstream  38 k
 httpd-tools       x86_64 2.4.37-39.module+el8.4.0+655+f2bfd6ee.1
                                                                appstream 105 k
 libatomic         x86_64 8.4.1-1.el8                           baseos     22 k
 mod_http2         x86_64 1.15.7-3.module+el8.4.0+553+7a69454b  appstream 153 k
 pgadmin4-desktop  x86_64 6.1-1.el8                             pgAdmin4   87 M
 pgadmin4-server   x86_64 6.1-1.el8                             pgAdmin4   91 M
 pgadmin4-web      noarch 6.1-1.el8                             pgAdmin4  8.6 k
 python3-mod_wsgi  x86_64 4.6.4-4.el8                           appstream 2.5 M
 rocky-logos-httpd noarch 84.5-8.el8                            baseos     22 k
Installing weak dependencies:
 apr-util-bdb      x86_64 1.6.1-6.el8.1                         appstream  23 k
 apr-util-openssl  x86_64 1.6.1-6.el8.1                         appstream  26 k
Enabling module streams:
 httpd                    2.4                                                  

Transaction Summary
Install  15 Packages

Total download size: 182 M
Installed size: 558 M
Is this ok [y/N]: y

Step 3 – Start the Apache webserver on Rocky Linux |AlmaLinux 8

To access the pgAdmin web UI, we need a web server, Apache has been installed automatically when installing pgAdmin. We, therefore, need to ensure that the Apache webserver is running on our system.

sudo systemctl start httpd

Enable Apache to run automatically on boot.

sudo systemctl enable httpd

Check the status of the service.

$ sudo systemctl status httpd
 httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2021-11-04 04:01:12 EDT; 8s ago
     Docs: man:httpd.service(8)
 Main PID: 48450 (httpd)
   Status: "Started, listening on: port 80"
    Tasks: 241 (limit: 23532)
   Memory: 64.3M
   CGroup: /system.slice/httpd.service
           ├─48450 /usr/sbin/httpd -DFOREGROUND
           ├─48451 /usr/sbin/httpd -DFOREGROUND
           ├─48452 /usr/sbin/httpd -DFOREGROUND
           ├─48453 /usr/sbin/httpd -DFOREGROUND
           ├─48454 /usr/sbin/httpd -DFOREGROUND
           └─48455 /usr/sbin/httpd -DFOREGROUND

Nov 04 04:01:12 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Nov 04 04:01:12 localhost.localdomain httpd[48450]: [Thu Nov 04 04:01:12.380306 2021] [so:warn] [pid 48450:tid 140690349939008] AH01574: module wsgi_>
Nov 04 04:01:12 localhost.localdomain httpd[48450]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using loca>
Nov 04 04:01:12 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
Nov 04 04:01:12 localhost.localdomain httpd[48450]: Server configured, listening on: port 80

Step 4 – Configure the PgAdmin 4 Web Service

PgAdmin has a script that creates a new user, sets up the PgAdmin web UI, and also manages the Apache webserver. The script is located at /usr/pgadmin4/bin/ and is executed as below:

sudo /usr/pgadmin4/bin/

Now you will be prompted to provide details that will, later on, be used to login to the pgAdmin 4 web UI. Proceed as below.

Setting up pgAdmin 4 in web mode on a Redhat 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: Enter Password here
Retype password: Re-enter Password here
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

Set SELinux in permissive mode as below.

sudo setenforce permissive

You also need to modify your firewall rules to allow HTTP traffic.

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

Use PgAdmin 4 in Rocky Linux | AlmaLinux 8 Linux

Now everything is set up, we can proceed to access the pgAdmin Web UI so that we can manage our PostgreSQL instance. Access the web interface using the URL http://server-ip/pgadmin4


Login with the credentials created in step 4 above. On successful login. you will be able to see this pgAdmin dashboard.


As seen, no database is connected to pgAdmin, and therefore, we need to add our PostgreSQL server by clicking on “Add Server” as shown.

Provide details for your PostgreSQL database server. Set the name for the database.


Then proceed to the next ‘Connection‘ tab and enter the credentials for the PostgreSQL database as below. (I have entered credentials for the superuser account created at the beginning of this guide)


If you are accessing the PostgreSQL database installed on a remote server, you will be required to Set SSH Tunnel. Provide the IP Address, username, and password of the remote server and proceed. With the details entered correctly, click save and you will see your database server added with additional details provided.


Create a Database in PostgreSQL using PgAdmin 4.

with the connection to your PostgreSQL server established, you can create a database as shown below.


Set the database name.


Proceed to the next tab and define your database.


Click sav, and you will have your database created as shown.


You can also make further configurations to the database.



That was enough learning! We have successfully gone through how to install and use pgAdmin 4 on Rocky Linux 8 | AlmaLinux 8. There are a lot of configurations and database management tools available on pgAdmin 4. I have only demonstrated a few. I hope this guide was of value to you.


Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.