Developed in Python, PgAdmin4 is a popular frontend management tool for the PostgreSQL database system. It provides all the features you need to manage your PostgreSQL databases from a web UI. PgAdmin 4 replaces PgAdmin III which was developed in the C++ language and supports PostgreSQL 9.2 and later releases. If you are not a fan of managing databases on the PostgreSQL shell, then PgAdmin4 is the go to management tool.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related PostgreSQL database queries on Linux systems.
In this context, we shall look into how to install PgAdmin4 on Rocky Linux 8.
Before starting this installation procedure, ensure that you have PostgreSQL installed on the system. You can follow our detailed guide here on how to install PostgreSQL 13 on Rocky Linux.
Next, follow the steps outlined below.
1. Add the PgAdmin 4 repository
The first step is to disable the PostgreSQL common repositories. This will allows us to grab the latest PgAdmin4 packages.
$ sudo yum-config-manager --disable pgdg-common
AppStream repository for Rocky Linux does not provide PgAdmin4 packages by default. Therefore we will add the PgAdmin repository by downloading and install it straight from the PostgreSQL official site as follows:
$ sudo rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-2-1.noarch.rpm
Once the repository is added, update the repositories to sync the newly added PostgreSQL repository:
$ sudo dnf update
When prompted, press 'y' to import the GPG key.
2. Install PgAdmin 4
Installing PgAdmin is quite easy from this point on. To do so, Simply execute the command:
$ sudo dnf install pgadmin4
This basically installs PgAdmin 4 and other PgAdmin4 dependencies.
3. Start the Apache webserver
Since PgAdmin 4 is powered by a web server and is accessed from the front-end, i.e web browser, we need to ensure that the Apache webserver is up and running. So, start the webserver and enable it on boot time:
$ sudo systemctl start httpd
$ sudo systemctl enable --now httpd
4. Configure PgAdmin4 web service
PgAdmin4 provide a shell script that creates a new user account for authenticating on a web browser, sets up PgAdmin4 in web mode, and restarts the Apache webserver to effect the changes.
Therefore, run the script as follows:
$ sudo /usr/pgadmin4/bin/setup-web.sh
Finally, access the PgAdmin4 interface from the browser using the URL indicated:
http://server-ip/pgadmin4
Provide the login credentials, i.e. the email and the password that you configured, and click on 'Login'.
This presents the PostgreSQL dashboard. From here, you can connect or add a new database server and manage your databases and tables.
This article covers how you can Install and easily get started with PgAdmin4 for your Linux system. pgAdmin is an advanced, open-source, full-featured, and web-based administration and management tool for the PostgreSQL database server.