How To Install pgAdmin 4 On Rocky Linux/Alma Linux 8

PGAdmin is a web-based GUI tool used to interact with the Postgres database sessions, both locally and remote servers as well. It is an open-source, powerful, and feature-rich graphical user interface (GUI) administration and management tool for the PostgreSQL database. It provides a powerful user interface that enables you to easily create, manage, maintain and use database objects, by both beginners and experienced Postgres users alike.

pgAdmin 4 supports PostgreSQL 9.2 or later, and runs on Unix and its variants such as Linux, Mac OS X as well as Windows operating systems.

In this article, we will learn how to install pgadmin 4 on Rocky Linux 8 server. This guide assumes that you already have Postgres 9.2 installed and set up. If not checkout How to Install and Configure Postgres 14 on Rocky Linux/Centos 8.

Related Content

Table of Content

  1. Ensuring that the server is up to date
  2. Setting up pgadmin 4 repo
  3. Installing pgadmin 4
  4. Accessing the pgAdmin 4 web interface

1. Ensuring that the server is up to date

Before proceeding, let us ensure that our server has updated packages. Use this command to achieve that:

sudo dnf update -y

2. Setting up pgadmin 4 repo

The pgadmin 4 package is not found in the default Rocky Linux repositories. Let us set up pgadmin repo that will allow us to install and keep track of updates for future pgadmin releases.

Install the yum-utils package.

sudo dnf install yum-utils

Next, disable the PostgreSQL common repositories to prepare for the installation of the latest PgAdmin4 packages.

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

To install the repo, run this command

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

3. Installing pgadmin 4

We can finally install pgadmin. pgadmin is available in both desktop and web mode. If you are running postgres on a local Rocky Linux system, the desktop mode is recommended, otherwise the web mode will work just fine. In my case I will be installing the web mode.

To Install for both desktop and web modes:

sudo dnf install -y pgadmin4

To Install for desktop mode only

sudo dnf install -y pgadmin4-desktop

To Install for web mode only:

sudo dnf install -y pgadmin4-web

Once you have the web mode installed, you need to configure it before using. The installation will help set up an initial user and a web server to serve the content. Use this command to configure

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

This is the output on my system:

$ sudo /usr/pgadmin4/bin/setup-web.sh
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: admin@citizix.com
Password:
Retype password:
pgAdmin 4 - Application Initialisation
======================================

Creating storage and log directories...
Configuring SELinux...
The Apache web server is not running. We can enable and start the web server for you to finish pgAdmin 4 installation. Continue (y/n)? y
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
Apache successfully enabled.
Apache successfully started.
You can now start using pgAdmin 4 in web mode at http://127.0.0.1/pgadmin4

4. Accessing the pgAdmin 4 web interface

Now you can access the pgAdmin 4 web interface. Open a web browser and point it to the address http://127.0.0.1/pgadmin4 or http://SERVER_IP/pgadmin4 and click Enter.

The pgadmin 4 login page will load prompting you for the email address and password that you set earlier. Click login after entering it.

After a successful login, you will land at the pgAdmin4 web interface default dashboard.

Citizix - pgadmin 4 dashboard

Citizix – pgadmin 4 dashboard

To connect to a database server, click on Add New Server. Then add the new server connection name and a comment. Click on the Connection Tab to provide the connection details I.e hostnamedatabase namedatabase username, and password as shown in the following screenshot. Once you are done, click Save.

Citizix - pgadmin add server

Citizix – pgadmin add server
Citizix - pgadmin add server conn details
Citizix – pgadmin add server conn details

Under the Browser, click on the Servers to expand. You should have the server you added. It will show the databases, roles, and table space. Expand the Database link to view the server performance overview under the Dashboard.

Citizix - pgadmin 4 server stats

Citizix – pgadmin 4 server stats

Wrapping up

We did manage to install pgadmin 4 on Rocky Linux 8 and add server connection in this guide.

comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy