How to install pgAdmin 4.30 on Centos 8

On This article we will discuss how to install pgAdmin 4.30 on Centos 8 operating system. pgAdmin 4 backend was written in Python, using Flask and Qt framework. It may be run either as a web or desktop application.

Introduction

pgAdmin is a management tool for PostgreSQL and derivative relational databases such as EnterpriseDB’s EDB Advanced Server. It may be run either as a web or desktop application. On this article we will discuss how to install the pgAdmin version 4.30, the latest version which was released 01 January, 2021. This latest version includes 38 bug fixes and new features, as noted on pgAdmin official page release notes.

PgAdmin 4.30 Installation On CentOS 8

Before we are going to install pgAdmin on CentOS 8, there are several prerequisite to be fulfilled, as shown below :

Prerequisites

  1. CentOS 8 System with sufficient disk space
  2. non-root user with administrative privileges
  3. firewall configured with firewalld

The pgAdmin 4.3 installation will be consist of several steps :

  • Enable Epel Repository
  • Enable pgAdmin Repository
  • Install pgAdmin
  • Configuring pgAdmin
  • Accessing pgAdmin 4.30 web

1. Enable Epel Repository

On this stage, we will enable Epel (Extra Packages for Enterprise Linux) repository on our CentOS 8 system. To install EPEL repo we will submit command line :

$ sudo dnf install epel-release

Output :

[ramans@localhost ~]$ sudo dnf install epel-release
[sudo] password for ramans: 
CentOS Linux 8 - AppStream                                                                           349  B/s | 4.3 kB     00:12    A
CentOS Linux 8 - AppStream                                                                           323 kB/s | 6.3 MB     00:19    
CentOS Linux 8 - BaseOS                                                                              3.8 kB/s | 3.9 kB     00:01    
CentOS Linux 8 - BaseOS                                                                              112 kB/s | 2.3 MB     00:20    
CentOS Linux 8 - Extras                                                                              1.7 kB/s | 1.5 kB     00:00    
Docker CE Stable - x86_64                                                                            1.5 kB/s | 3.5 kB     00:02    
Docker CE Stable - x86_64                                                                             18 kB/s | 7.8 kB     00:00    
pgadmin4                                                                                             1.8 kB/s | 2.9 kB     00:01    
pgadmin4                                                                                              44 kB/s | 501 kB     00:11    
PostgreSQL common RPMs for RHEL/CentOS 8 - x86_64                                                    1.1 kB/s | 3.0 kB     00:02    
PostgreSQL common RPMs for RHEL/CentOS 8 - x86_64                                                     63 kB/s | 534 kB     00:08    
PostgreSQL 13 for RHEL/CentOS 8 - x86_64                                                             2.2 kB/s | 3.8 kB     00:01    
PostgreSQL 13 for RHEL/CentOS 8 - x86_64                                                              50 kB/s | 224 kB     00:04    
PostgreSQL 12 for RHEL/CentOS 8 - x86_64                                                             2.7 kB/s | 3.8 kB     00:01    
PostgreSQL 12 for RHEL/CentOS 8 - x86_64                                                              39 kB/s | 417 kB     00:10    
PostgreSQL 11 for RHEL/CentOS 8 - x86_64                                                             1.8 kB/s | 3.8 kB     00:02    
PostgreSQL 11 for RHEL/CentOS 8 - x86_64                                                             141 kB/s | 612 kB     00:04    
PostgreSQL 10 for RHEL/CentOS 8 - x86_64                                                             2.2 kB/s | 3.8 kB     00:01    
PostgreSQL 10 for RHEL/CentOS 8 - x86_64                                                             105 kB/s | 422 kB     00:04    
PostgreSQL 9.6 for RHEL/CentOS 8 - x86_64                                                            2.3 kB/s | 3.8 kB     00:01    
PostgreSQL 9.6 for RHEL/CentOS 8 - x86_64                                                            114 kB/s | 429 kB     00:03    
PostgreSQL 9.5 for RHEL/CentOS 8 - x86_64                                                            2.6 kB/s | 3.8 kB     00:01    
PostgreSQL 9.5 for RHEL/CentOS 8 - x86_64                                                             82 kB/s | 365 kB     00:04    
Dependencies resolved.
=====================================================================================================================================
 Package                            Architecture                 Version                          Repository                    Size
=====================================================================================================================================
Installing:
 epel-release                       noarch                       8-8.el8                          extras                        23 k

Transaction Summary
=====================================================================================================================================
Install  1 Package

Total download size: 23 k
Installed size: 32 k
Is this ok [y/N]: y
Downloading Packages:
epel-release-8-8.el8.noarch.rpm                                                                       43 kB/s |  23 kB     00:00    
-------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                 12 kB/s |  23 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                             1/1 
  Installing       : epel-release-8-8.el8.noarch                                                                                 1/1 
  Running scriptlet: epel-release-8-8.el8.noarch                                                                                 1/1 
  Verifying        : epel-release-8-8.el8.noarch                                                                                 1/1 
Installed products updated.

Installed:
  epel-release-8-8.el8.noarch                                                                                                        

Complete!

2. Enable pgAdmin Repository

On this stage, we will enable pgAdmin repository by donwloading its file pgAdmin source from official PostgreSQL web site. To download the source, we will use wget command line tools as shown below :

$ sudo dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

Output :

[ramans@localhost ~]$ sudo dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Extra Packages for Enterprise Linux Modular 8 - x86_64                                               163 kB/s | 536 kB     00:03    
Extra Packages for Enterprise Linux 8 - x86_64                                                        47 kB/s | 8.8 MB     03:12    
Last metadata expiration check: 0:00:01 ago on Mon 01 Feb 2021 06:35:02 AM PST.
pgdg-redhat-repo-latest.noarch.rpm                                                                   5.9 kB/s |  11 kB     00:01    
Dependencies resolved.
=====================================================================================================================================
 Package                              Architecture               Version                      Repository                        Size
=====================================================================================================================================
Downgrading:
 pgdg-redhat-repo                     noarch                     42.0-14                      @commandline                      11 k

Transaction Summary
=====================================================================================================================================
Downgrade  1 Package

Total size: 11 k
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                             1/1   Downgrading      : pgdg-redhat-repo-42.0-14.noarch                                                                             1/2   Cleanup          : pgdg-redhat-repo-42.0-15.noarch                                                                             2/2   Verifying        : pgdg-redhat-repo-42.0-14.noarch                                                                             1/2   Verifying        : pgdg-redhat-repo-42.0-15.noarch                                                                             2/2 Installed products updated.

Downgraded:
  pgdg-redhat-repo-42.0-14.noarch                                                                                                    

Complete!

3. Install pgAdmin on CentOS 8

After all are set, then we will install pgAdmin on CentOS by using command line :

$ sudo dnf -qy module disable postgresql
$ sudo dnf install pgadmin4

Output :

[ramans@localhost ~]$ sudo dnf -qy module disable postgresql
[sudo] password for ramans: 
[ramans@localhost ~]$ sudo dnf install pgadmin4
Last metadata expiration check: 0:10:52 ago on Mon 01 Feb 2021 06:35:02 AM PST.
Dependencies resolved.
=====================================================================================================================================
 Package                                          Architecture        Version                         Repository                Size
=====================================================================================================================================
Installing:
 pgadmin4                                         x86_64              4.30-1.rhel8                    pgdg-common               18 k
Installing dependencies:
 libsodium                                        x86_64              1.0.18-2.el8                    epel                     162 k
 pgadmin4-docs                                    noarch              4.30-1.rhel8                    pgdg-common               50 M
 pgadmin4-python3-Flask-Mail                      noarch              0.9.1-4.rhel8.1                 pgdg-common               24 k
 pgadmin4-python3-alembic                         noarch              0.9.7-4.rhel8                   pgdg-common              268 k
 pgadmin4-python3-dateutil                        noarch              1:2.8.0-1.rhel8                 pgdg-common              290 k
 pgadmin4-python3-flask                           noarch              1:1.0.2-1.rhel8                 pgdg-common              153 k
 pgadmin4-python3-flask-babelex                   noarch              0.9.4-1.rhel8                   pgdg-common               23 k
 pgadmin4-python3-flask-compress                  noarch              1.4.0-1.rhel8                   pgdg-common               15 k
 pgadmin4-python3-flask-gravatar                  noarch              0.5.0-1.rhel8.1                 pgdg-common               17 k
 pgadmin4-python3-flask-login                     noarch              0.4.1-1.rhel8                   pgdg-common               34 k
 pgadmin4-python3-flask-migrate                   noarch              2.4.0-1.rhel8                   pgdg-common               28 k
 pgadmin4-python3-flask-paranoid                  noarch              0.2-1.rhel8.1                   pgdg-common               15 k
 pgadmin4-python3-flask-principal                 noarch              0.4.0-14.rhel8.1                pgdg-common               20 k
 pgadmin4-python3-flask-security-too              noarch              3.3.3-1.rhel8                   pgdg-common              144 k
 pgadmin4-python3-flask-sqlalchemy                noarch              2.4.1-1.rhel8                   pgdg-common               83 k
 pgadmin4-python3-flask-wtf                       noarch              0.14.3-2.rhel8                  pgdg-common               59 k
 pgadmin4-python3-passlib                         noarch              1.7.2-1.rhel8                   pgdg-common              757 k
 pgadmin4-python3-psutil                          x86_64              5.7.0-1.rhel8                   pgdg-common              396 k
 pgadmin4-python3-simplejson                      x86_64              3.16.0-1.rhel8                  pgdg-common              278 k
 pgadmin4-python3-six                             noarch              1.12.0-3.rhel8                  pgdg-common               35 k
 pgadmin4-python3-speaklater                      noarch              1.3-3.rhel8.1                   pgdg-common               15 k
 pgadmin4-python3-sqlalchemy                      x86_64              1.3.13-2.rhel8                  pgdg-common              4.1 M
 pgadmin4-python3-sqlparse                        noarch              0.3.0-1.rhel8                   pgdg-common               81 k
 pgadmin4-python3-sshtunnel                       noarch              0.3.1-1.rhel8                   pgdg-common               46 k
 pgadmin4-python3-werkzeug                        noarch              0.15.4-1.rhel8                  pgdg-common              464 k
 pgadmin4-python3-wtforms                         noarch              2.2.1-1.rhel8                   pgdg-common              184 k
 pgadmin4-pytz                                    noarch              2020.1-1.rhel8                  pgdg-common               54 k
 pgadmin4-web                                     noarch              4.30-1.rhel8                    pgdg-common              6.5 M
 python3-babel                                    noarch              2.5.1-5.el8                     appstream                4.8 M
 python3-bcrypt                                   x86_64              3.1.6-2.el8.1                   epel                      44 k
 python3-blinker                                  noarch              1.4-4.el8                       epel                     114 k
 python3-click                                    noarch              6.7-8.el8                       appstream                131 k
 python3-dns                                      noarch              1.15.0-10.el8                   baseos                   253 k
 python3-email-validator                          noarch              1.0.5-2.el8                     epel                      27 k
 python3-flask                                    noarch              1:0.12.2-4.el8                  appstream                141 k
 python3-itsdangerous                             noarch              0.24-14.el8                     appstream                 31 k
 python3-jinja2                                   noarch              2.10.1-2.el8_0                  appstream                538 k
 python3-ldap3                                    noarch              2.8.1-2.el8                     epel                     535 k
 python3-mako                                     noarch              1.0.6-13.el8                    appstream                157 k
 python3-markupsafe                               x86_64              0.23-19.el8                     appstream                 39 k
 python3-mod_wsgi                                 x86_64              4.6.4-4.el8                     appstream                2.5 M
 python3-paramiko                                 noarch              2.4.3-1.el8                     epel                     289 k
 python3-psycopg2                                 x86_64              2.8.6-1.rhel8                   pgdg-common              178 k
 python3-pyasn1                                   noarch              0.3.7-6.el8                     appstream                126 k
 python3-pynacl                                   x86_64              1.3.0-5.el8                     epel                     100 k
 python3-werkzeug                                 noarch              0.12.2-4.el8                    appstream                457 k

Transaction Summary
=====================================================================================================================================
Install  47 Packages

Total download size: 74 M
Installed size: 177 M
Is this ok [y/N]: y
Downloading Packages:
(1/47): python3-click-6.7-8.el8.noarch.rpm                                                           156 kB/s | 131 kB     00:00    
(2/47): python3-flask-0.12.2-4.el8.noarch.rpm                                                        165 kB/s | 141 kB     00:00    
(3/47): python3-itsdangerous-0.24-14.el8.noarch.rpm                                                   44 kB/s |  31 kB     00:00    
(4/47): python3-mako-1.0.6-13.el8.noarch.rpm                                                         157 kB/s | 157 kB     00:00    
(5/47): python3-jinja2-2.10.1-2.el8_0.noarch.rpm                                                     297 kB/s | 538 kB     00:01    
(6/47): python3-markupsafe-0.23-19.el8.x86_64.rpm                                                     71 kB/s |  39 kB     00:00    
[MIRROR] python3-babel-2.5.1-5.el8.noarch.rpm: Curl error (56): Failure when receiving data from the peer for http://mirror.poliwangi.ac.id/centos/8.3.2011/AppStream/x86_64/os/Packages/python3-babel-2.5.1-5.el8.noarch.rpm [Recv failure: Connection reset by peer]
[MIRROR] python3-mod_wsgi-4.6.4-4.el8.x86_64.rpm: Curl error (56): Failure when receiving data from the peer for http://mirror.poliwangi.ac.id/centos/8.3.2011/AppStream/x86_64/os/Packages/python3-mod_wsgi-4.6.4-4.el8.x86_64.rpm [Recv failure: Connection reset by peer]
(7/47): python3-pyasn1-0.3.7-6.el8.noarch.rpm                                                        6.8 kB/s | 126 kB     00:18    
(8/47): python3-werkzeug-0.12.2-4.el8.noarch.rpm                                                     434 kB/s | 457 kB     00:01    
[MIRROR] python3-mod_wsgi-4.6.4-4.el8.x86_64.rpm: Status code: 502 for http://mirror.telkomuniversity.ac.id/centos/8.3.2011/AppStream/x86_64/os/Packages/python3-mod_wsgi-4.6.4-4.el8.x86_64.rpm (IP: 103.233.100.107)
(9/47): python3-dns-1.15.0-10.el8.noarch.rpm                                                          48 kB/s | 253 kB     00:05    
(10/47): python3-babel-2.5.1-5.el8.noarch.rpm                                                        161 kB/s | 4.8 MB     00:30    
(11/47): python3-bcrypt-3.1.6-2.el8.1.x86_64.rpm                                                     307 kB/s |  44 kB     00:00    
(12/47): python3-blinker-1.4-4.el8.noarch.rpm                                                        199 kB/s | 114 kB     00:00    
(13/47): python3-email-validator-1.0.5-2.el8.noarch.rpm                                              111 kB/s |  27 kB     00:00    
[MIRROR] libsodium-1.0.18-2.el8.x86_64.rpm: Status code: 502 for http://epel.mirror.angkasa.id/pub/epel/8/Everything/x86_64/Packages/l/libsodium-1.0.18-2.el8.x86_64.rpm (IP: 103.29.148.124)
(14/47): python3-ldap3-2.8.1-2.el8.noarch.rpm                                                        370 kB/s | 535 kB     00:01    
(15/47): python3-paramiko-2.4.3-1.el8.noarch.rpm                                                     167 kB/s | 289 kB     00:01    
(16/47): libsodium-1.0.18-2.el8.x86_64.rpm                                                            19 kB/s | 162 kB     00:08    
(17/47): python3-pynacl-1.3.0-5.el8.x86_64.rpm                                                        54 kB/s | 100 kB     00:01    
(18/47): python3-mod_wsgi-4.6.4-4.el8.x86_64.rpm                                                      71 kB/s | 2.5 MB     00:35    
(19/47): pgadmin4-4.30-1.rhel8.x86_64.rpm                                                            6.3 kB/s |  18 kB     00:02    
(20/47): pgadmin4-python3-Flask-Mail-0.9.1-4.rhel8.1.noarch.rpm                                       13 kB/s |  24 kB     00:01    
(21/47): pgadmin4-python3-alembic-0.9.7-4.rhel8.noarch.rpm                                            90 kB/s | 268 kB     00:02    
(22/47): pgadmin4-python3-dateutil-2.8.0-1.rhel8.noarch.rpm                                           78 kB/s | 290 kB     00:03    
(23/47): pgadmin4-python3-flask-babelex-0.9.4-1.rhel8.noarch.rpm                                      27 kB/s |  23 kB     00:00    
(24/47): pgadmin4-python3-flask-compress-1.4.0-1.rhel8.noarch.rpm                                     27 kB/s |  15 kB     00:00    
(25/47): pgadmin4-python3-flask-1.0.2-1.rhel8.noarch.rpm                                              46 kB/s | 153 kB     00:03    
(26/47): pgadmin4-python3-flask-gravatar-0.5.0-1.rhel8.1.noarch.rpm                                   55 kB/s |  17 kB     00:00    
(27/47): pgadmin4-python3-flask-migrate-2.4.0-1.rhel8.noarch.rpm                                      38 kB/s |  28 kB     00:00    
(28/47): pgadmin4-python3-flask-login-0.4.1-1.rhel8.noarch.rpm                                        31 kB/s |  34 kB     00:01    
(29/47): pgadmin4-python3-flask-paranoid-0.2-1.rhel8.1.noarch.rpm                                     55 kB/s |  15 kB     00:00    
(30/47): pgadmin4-python3-flask-principal-0.4.0-14.rhel8.1.noarch.rpm                                 19 kB/s |  20 kB     00:01    
(31/47): pgadmin4-python3-flask-security-too-3.3.3-1.rhel8.noarch.rpm                                145 kB/s | 144 kB     00:00    
(32/47): pgadmin4-python3-flask-wtf-0.14.3-2.rhel8.noarch.rpm                                        178 kB/s |  59 kB     00:00    
(33/47): pgadmin4-python3-flask-sqlalchemy-2.4.1-1.rhel8.noarch.rpm                                   32 kB/s |  83 kB     00:02    
(34/47): pgadmin4-python3-passlib-1.7.2-1.rhel8.noarch.rpm                                            92 kB/s | 757 kB     00:08    
(35/47): pgadmin4-python3-psutil-5.7.0-1.rhel8.x86_64.rpm                                             66 kB/s | 396 kB     00:06    
(36/47): pgadmin4-python3-six-1.12.0-3.rhel8.noarch.rpm                                               51 kB/s |  35 kB     00:00    
(37/47): pgadmin4-python3-speaklater-1.3-3.rhel8.1.noarch.rpm                                         18 kB/s |  15 kB     00:00    
(38/47): pgadmin4-python3-simplejson-3.16.0-1.rhel8.x86_64.rpm                                       126 kB/s | 278 kB     00:02    
(39/47): pgadmin4-python3-sqlparse-0.3.0-1.rhel8.noarch.rpm                                           76 kB/s |  81 kB     00:01    
(40/47): pgadmin4-python3-sshtunnel-0.3.1-1.rhel8.noarch.rpm                                          19 kB/s |  46 kB     00:02    
(41/47): pgadmin4-python3-werkzeug-0.15.4-1.rhel8.noarch.rpm                                          35 kB/s | 464 kB     00:13    
(42/47): pgadmin4-python3-wtforms-2.2.1-1.rhel8.noarch.rpm                                            63 kB/s | 184 kB     00:02    
(43/47): pgadmin4-pytz-2020.1-1.rhel8.noarch.rpm                                                      62 kB/s |  54 kB     00:00    
(44/47): pgadmin4-python3-sqlalchemy-1.3.13-2.rhel8.x86_64.rpm                                        60 kB/s | 4.1 MB     01:09    
(45/47): python3-psycopg2-2.8.6-1.rhel8.x86_64.rpm                                                   117 kB/s | 178 kB     00:01    
(46/47): pgadmin4-web-4.30-1.rhel8.noarch.rpm                                                         83 kB/s | 6.5 MB     01:19    
(47/47): pgadmin4-docs-4.30-1.rhel8.noarch.rpm                                                       272 kB/s |  50 MB     03:07    
-------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                329 kB/s |  74 MB     03:51     
warning: /var/cache/dnf/epel-6519ee669354a484/packages/libsodium-1.0.18-2.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 2f86d6a1: NOKEY
Extra Packages for Enterprise Linux 8 - x86_64                                                       1.6 MB/s | 1.6 kB     00:00    
Importing GPG key 0x2F86D6A1:
 Userid     : "Fedora EPEL (8) <epel@fedoraproject.org>"
 Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
Is this ok [y/N]: y        
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                             1/1 
  Installing       : python3-babel-2.5.1-5.el8.noarch                                                                           1/47 
  Installing       : pgadmin4-python3-six-1.12.0-3.rhel8.noarch                                                                 2/47 
  Installing       : pgadmin4-python3-flask-compress-1.4.0-1.rhel8.noarch                                                       3/47 
  Installing       : python3-blinker-1.4-4.el8.noarch                                                                           4/47 
  Installing       : python3-bcrypt-3.1.6-2.el8.1.x86_64                                                                        5/47 
  Installing       : python3-werkzeug-0.12.2-4.el8.noarch                                                                       6/47 
  Installing       : python3-pyasn1-0.3.7-6.el8.noarch                                                                          7/47 
  Installing       : python3-markupsafe-0.23-19.el8.x86_64                                                                      8/47 
  Installing       : python3-jinja2-2.10.1-2.el8_0.noarch                                                                       9/47 
  Installing       : python3-itsdangerous-0.24-14.el8.noarch                                                                   10/47 
  Installing       : python3-click-6.7-8.el8.noarch                                                                            11/47 
  Installing       : pgadmin4-python3-flask-1:1.0.2-1.rhel8.noarch                                                             12/47 
  Installing       : python3-flask-1:0.12.2-4.el8.noarch                                                                       13/47 
  Installing       : pgadmin4-python3-flask-migrate-2.4.0-1.rhel8.noarch                                                       14/47 
  Installing       : pgadmin4-python3-flask-principal-0.4.0-14.rhel8.1.noarch                                                  15/47 
  Installing       : pgadmin4-python3-flask-babelex-0.9.4-1.rhel8.noarch                                                       16/47 
  Installing       : pgadmin4-python3-flask-gravatar-0.5.0-1.rhel8.1.noarch                                                    17/47 
  Installing       : python3-mako-1.0.6-13.el8.noarch                                                                          18/47 
  Installing       : python3-ldap3-2.8.1-2.el8.noarch                                                                          19/47 
  Installing       : python3-psycopg2-2.8.6-1.rhel8.x86_64                                                                     20/47 
  Installing       : pgadmin4-pytz-2020.1-1.rhel8.noarch                                                                       21/47 
  Installing       : pgadmin4-python3-wtforms-2.2.1-1.rhel8.noarch                                                             22/47 
  Installing       : pgadmin4-python3-werkzeug-0.15.4-1.rhel8.noarch                                                           23/47 
  Installing       : pgadmin4-python3-sqlparse-0.3.0-1.rhel8.noarch                                                            24/47 
  Installing       : pgadmin4-python3-sqlalchemy-1.3.13-2.rhel8.x86_64                                                         25/47 
  Installing       : pgadmin4-python3-speaklater-1.3-3.rhel8.1.noarch                                                          26/47 
  Installing       : pgadmin4-python3-simplejson-3.16.0-1.rhel8.x86_64                                                         27/47 
  Installing       : pgadmin4-python3-psutil-5.7.0-1.rhel8.x86_64                                                              28/47 
  Installing       : pgadmin4-python3-passlib-1.7.2-1.rhel8.noarch                                                             29/47 
  Installing       : pgadmin4-python3-flask-wtf-0.14.3-2.rhel8.noarch                                                          30/47 
  Installing       : pgadmin4-python3-flask-sqlalchemy-2.4.1-1.rhel8.noarch                                                    31/47 
  Installing       : pgadmin4-python3-flask-security-too-3.3.3-1.rhel8.noarch                                                  32/47 
  Installing       : pgadmin4-python3-flask-paranoid-0.2-1.rhel8.1.noarch                                                      33/47 
  Installing       : pgadmin4-python3-flask-login-0.4.1-1.rhel8.noarch                                                         34/47 
  Installing       : pgadmin4-python3-dateutil-1:2.8.0-1.rhel8.noarch                                                          35/47 
  Installing       : pgadmin4-python3-alembic-0.9.7-4.rhel8.noarch                                                             36/47 
  Installing       : pgadmin4-python3-Flask-Mail-0.9.1-4.rhel8.1.noarch                                                        37/47 
  Installing       : pgadmin4-docs-4.30-1.rhel8.noarch                                                                         38/47 
  Installing       : libsodium-1.0.18-2.el8.x86_64                                                                             39/47 
  Installing       : python3-pynacl-1.3.0-5.el8.x86_64                                                                         40/47 
  Installing       : python3-paramiko-2.4.3-1.el8.noarch                                                                       41/47 
  Installing       : pgadmin4-python3-sshtunnel-0.3.1-1.rhel8.noarch                                                           42/47 
  Installing       : python3-dns-1.15.0-10.el8.noarch                                                                          43/47 
  Installing       : python3-email-validator-1.0.5-2.el8.noarch                                                                44/47 
  Installing       : python3-mod_wsgi-4.6.4-4.el8.x86_64                                                                       45/47 
  Installing       : pgadmin4-web-4.30-1.rhel8.noarch                                                                          46/47 
  Installing       : pgadmin4-4.30-1.rhel8.x86_64                                                                              47/47 
  Running scriptlet: pgadmin4-4.30-1.rhel8.x86_64                                                                              47/47 
  Verifying        : python3-babel-2.5.1-5.el8.noarch                                                                           1/47 
  Verifying        : python3-click-6.7-8.el8.noarch                                                                             2/47 
  Verifying        : python3-flask-1:0.12.2-4.el8.noarch                                                                        3/47 
  Verifying        : python3-itsdangerous-0.24-14.el8.noarch                                                                    4/47 
  Verifying        : python3-jinja2-2.10.1-2.el8_0.noarch                                                                       5/47 
  Verifying        : python3-mako-1.0.6-13.el8.noarch                                                                           6/47 
  Verifying        : python3-markupsafe-0.23-19.el8.x86_64                                                                      7/47 
  Verifying        : python3-mod_wsgi-4.6.4-4.el8.x86_64                                                                        8/47 
  Verifying        : python3-pyasn1-0.3.7-6.el8.noarch                                                                          9/47 
  Verifying        : python3-werkzeug-0.12.2-4.el8.noarch                                                                      10/47 
  Verifying        : python3-dns-1.15.0-10.el8.noarch                                                                          11/47 
  Verifying        : libsodium-1.0.18-2.el8.x86_64                                                                             12/47 
  Verifying        : python3-bcrypt-3.1.6-2.el8.1.x86_64                                                                       13/47 
  Verifying        : python3-blinker-1.4-4.el8.noarch                                                                          14/47 
  Verifying        : python3-email-validator-1.0.5-2.el8.noarch                                                                15/47 
  Verifying        : python3-ldap3-2.8.1-2.el8.noarch                                                                          16/47 
  Verifying        : python3-paramiko-2.4.3-1.el8.noarch                                                                       17/47 
  Verifying        : python3-pynacl-1.3.0-5.el8.x86_64                                                                         18/47 
  Verifying        : pgadmin4-4.30-1.rhel8.x86_64                                                                              19/47 
  Verifying        : pgadmin4-docs-4.30-1.rhel8.noarch                                                                         20/47 
  Verifying        : pgadmin4-python3-Flask-Mail-0.9.1-4.rhel8.1.noarch                                                        21/47 
  Verifying        : pgadmin4-python3-alembic-0.9.7-4.rhel8.noarch                                                             22/47 
  Verifying        : pgadmin4-python3-dateutil-1:2.8.0-1.rhel8.noarch                                                          23/47 
  Verifying        : pgadmin4-python3-flask-1:1.0.2-1.rhel8.noarch                                                             24/47 
  Verifying        : pgadmin4-python3-flask-babelex-0.9.4-1.rhel8.noarch                                                       25/47 
  Verifying        : pgadmin4-python3-flask-compress-1.4.0-1.rhel8.noarch                                                      26/47 
  Verifying        : pgadmin4-python3-flask-gravatar-0.5.0-1.rhel8.1.noarch                                                    27/47 
  Verifying        : pgadmin4-python3-flask-login-0.4.1-1.rhel8.noarch                                                         28/47 
  Verifying        : pgadmin4-python3-flask-migrate-2.4.0-1.rhel8.noarch                                                       29/47 
  Verifying        : pgadmin4-python3-flask-paranoid-0.2-1.rhel8.1.noarch                                                      30/47 
  Verifying        : pgadmin4-python3-flask-principal-0.4.0-14.rhel8.1.noarch                                                  31/47 
  Verifying        : pgadmin4-python3-flask-security-too-3.3.3-1.rhel8.noarch                                                  32/47 
  Verifying        : pgadmin4-python3-flask-sqlalchemy-2.4.1-1.rhel8.noarch                                                    33/47 
  Verifying        : pgadmin4-python3-flask-wtf-0.14.3-2.rhel8.noarch                                                          34/47 
  Verifying        : pgadmin4-python3-passlib-1.7.2-1.rhel8.noarch                                                             35/47 
  Verifying        : pgadmin4-python3-psutil-5.7.0-1.rhel8.x86_64                                                              36/47 
  Verifying        : pgadmin4-python3-simplejson-3.16.0-1.rhel8.x86_64                                                         37/47 
  Verifying        : pgadmin4-python3-six-1.12.0-3.rhel8.noarch                                                                38/47 
  Verifying        : pgadmin4-python3-speaklater-1.3-3.rhel8.1.noarch                                                          39/47 
  Verifying        : pgadmin4-python3-sqlalchemy-1.3.13-2.rhel8.x86_64                                                         40/47 
  Verifying        : pgadmin4-python3-sqlparse-0.3.0-1.rhel8.noarch                                                            41/47 
  Verifying        : pgadmin4-python3-sshtunnel-0.3.1-1.rhel8.noarch                                                           42/47 
  Verifying        : pgadmin4-python3-werkzeug-0.15.4-1.rhel8.noarch                                                           43/47 
  Verifying        : pgadmin4-python3-wtforms-2.2.1-1.rhel8.noarch                                                             44/47 
  Verifying        : pgadmin4-pytz-2020.1-1.rhel8.noarch                                                                       45/47 
  Verifying        : pgadmin4-web-4.30-1.rhel8.noarch                                                                          46/47 
  Verifying        : python3-psycopg2-2.8.6-1.rhel8.x86_64                                                                     47/47 
Installed products updated.

Installed:
  libsodium-1.0.18-2.el8.x86_64                                     pgadmin4-4.30-1.rhel8.x86_64                                     
  pgadmin4-docs-4.30-1.rhel8.noarch                                 pgadmin4-python3-Flask-Mail-0.9.1-4.rhel8.1.noarch               
  pgadmin4-python3-alembic-0.9.7-4.rhel8.noarch                     pgadmin4-python3-dateutil-1:2.8.0-1.rhel8.noarch                 
  pgadmin4-python3-flask-1:1.0.2-1.rhel8.noarch                     pgadmin4-python3-flask-babelex-0.9.4-1.rhel8.noarch              
  pgadmin4-python3-flask-compress-1.4.0-1.rhel8.noarch              pgadmin4-python3-flask-gravatar-0.5.0-1.rhel8.1.noarch           
  pgadmin4-python3-flask-login-0.4.1-1.rhel8.noarch                 pgadmin4-python3-flask-migrate-2.4.0-1.rhel8.noarch              
  pgadmin4-python3-flask-paranoid-0.2-1.rhel8.1.noarch              pgadmin4-python3-flask-principal-0.4.0-14.rhel8.1.noarch         
  pgadmin4-python3-flask-security-too-3.3.3-1.rhel8.noarch          pgadmin4-python3-flask-sqlalchemy-2.4.1-1.rhel8.noarch           
  pgadmin4-python3-flask-wtf-0.14.3-2.rhel8.noarch                  pgadmin4-python3-passlib-1.7.2-1.rhel8.noarch                    
  pgadmin4-python3-psutil-5.7.0-1.rhel8.x86_64                      pgadmin4-python3-simplejson-3.16.0-1.rhel8.x86_64                
  pgadmin4-python3-six-1.12.0-3.rhel8.noarch                        pgadmin4-python3-speaklater-1.3-3.rhel8.1.noarch                 
  pgadmin4-python3-sqlalchemy-1.3.13-2.rhel8.x86_64                 pgadmin4-python3-sqlparse-0.3.0-1.rhel8.noarch                   
  pgadmin4-python3-sshtunnel-0.3.1-1.rhel8.noarch                   pgadmin4-python3-werkzeug-0.15.4-1.rhel8.noarch                  
  pgadmin4-python3-wtforms-2.2.1-1.rhel8.noarch                     pgadmin4-pytz-2020.1-1.rhel8.noarch                              
  pgadmin4-web-4.30-1.rhel8.noarch                                  python3-babel-2.5.1-5.el8.noarch                                 
  python3-bcrypt-3.1.6-2.el8.1.x86_64                               python3-blinker-1.4-4.el8.noarch                                 
  python3-click-6.7-8.el8.noarch                                    python3-dns-1.15.0-10.el8.noarch                                 
  python3-email-validator-1.0.5-2.el8.noarch                        python3-flask-1:0.12.2-4.el8.noarch                              
  python3-itsdangerous-0.24-14.el8.noarch                           python3-jinja2-2.10.1-2.el8_0.noarch                             
  python3-ldap3-2.8.1-2.el8.noarch                                  python3-mako-1.0.6-13.el8.noarch                                 
  python3-markupsafe-0.23-19.el8.x86_64                             python3-mod_wsgi-4.6.4-4.el8.x86_64                              
  python3-paramiko-2.4.3-1.el8.noarch                               python3-psycopg2-2.8.6-1.rhel8.x86_64                            
  python3-pyasn1-0.3.7-6.el8.noarch                                 python3-pynacl-1.3.0-5.el8.x86_64                                
  python3-werkzeug-0.12.2-4.el8.noarch                             

Complete!

After installation was completed done, then we will bring the web server service up, on this tutorial we are using nginx as web server. To start and check Apache service we will use th following command line :

$ sudo systemctl start httpd
$ sudo systemctl status nginx

Output :

[ramans@localhost ~]$ sudo systemctl start httpd
[ramans@localhost ~]$ sudo systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2021-02-01 06:55:43 PST; 15s ago
     Docs: man:httpd.service(8)
 Main PID: 5205 (httpd)
   Status: "Running, listening on: port 80"
    Tasks: 213 (limit: 49341)
   Memory: 56.1M
   CGroup: /system.slice/httpd.service
           ├─5205 /usr/sbin/httpd -DFOREGROUND
           ├─5212 /usr/sbin/httpd -DFOREGROUND
           ├─5213 /usr/sbin/httpd -DFOREGROUND
           ├─5214 /usr/sbin/httpd -DFOREGROUND
           └─5215 /usr/sbin/httpd -DFOREGROUND

Feb 01 06:55:43 localhost systemd[1]: Starting The Apache HTTP Server...
Feb 01 06:55:43 localhost httpd[5205]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using >
Feb 01 06:55:43 localhost systemd[1]: Started The Apache HTTP Server.
Feb 01 06:55:43 localhost httpd[5205]: Server configured, listening on: port 80

4. Configuring pgAdmin 4

On this stage, we will configure pgAdmin on our CentOS 8 environment. To configure pgAdmin we will modify pgAdmin configuration file which is provided /etc/httpd/conf.d/pgadmin4.conf.sample. We will make a copy and modify it according to the needs of our environment.

[ramans@localhost ~]$ sudo cp /etc/httpd/conf.d/pgadmin4.conf.sample /etc/httpd/conf.d/pgadmin4.conf
[ramans@localhost ~]$ sudo vi /etc/httpd/conf.d/pgadmin4.conf
LoadModule wsgi_module modules/mod_wsgi.so
WSGIDaemonProcess pgadmin processes=1 threads=25
WSGIScriptAlias /pgadmin4 /usr/lib/python3.6/site-packages/pgadmin4-web/pgAdmin4.wsgi

<Directory /usr/lib/python3.6/site-packages/pgadmin4-web/>
        WSGIProcessGroup pgadmin
        WSGIApplicationGroup %{GLOBAL}
        <IfModule mod_authz_core.c>
                # Apache 2.4
                Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
                # Apache 2.2
                Order Deny,Allow
                Deny from All
                Allow from 127.0.0.1
                Allow from ::1
        </IfModule>
</Directory>

Then we have to restart our Web server again by submitting command line :

$ sudo systemctl restart httpd

Then we will create a new two file for holding log file.

sudo mkdir -p /var/lib/pgadmin4/ /var/log/pgadmin4/

4.1 Modify Configurable Python Script

The pgadmin4 installation is accompanied with a configurable script to configure the pgAdmin web service, which will create a user account used to authenticate in the web interface, configure SELinux policies and Apache webserver to deploy pgAdmin web service.

After creating the new two directories the we have to declare the location/path of the log file, SQLite database, session database and storage in the Python configuration file for pgAdmin in the file. The file is located on /usr/lib/python3.6/site-packages/pgadmin4-web/config_distro.py.

[ramans@localhost ~]$ sudo mkdir -p /var/lib/pgadmin4/ /var/log/pgadmin4/
[ramans@localhost ~]$ sudo vi /usr/lib/python3.6/site-packages/pgadmin4-web/config_distro.py
HELP_PATH = '/usr/share/doc/pgadmin4-docs/en_US/html'
UPGRADE_CHECK_ENABLED = False
LOG_FILE = '/var/log/pgadmin4/pgadmin4.log'
SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'
SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'
STORAGE_DIR = '/var/lib/pgadmin4/storage'
~                                                                            
$ sudo dnf -y install python3-bcrypt python3-pynacl

Output :

[ramans@localhost ~]$ sudo dnf -y install python3-bcrypt python3-pynacl
Last metadata expiration check: 0:27:39 ago on Mon 01 Feb 2021 06:35:02 AM PST.
Package python3-bcrypt-3.1.6-2.el8.1.x86_64 is already installed.
Package python3-pynacl-1.3.0-5.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
$ sudo python3 /usr/lib/python3.6/site-packages/pgadmin4-web/setup.py

Output :

[ramans@localhost ~]$ sudo python3 /usr/lib/python3.6/site-packages/pgadmin4-web/setup.py
NOTE: Configuring authentication for SERVER mode.

Enter the email address and password to use for the initial pgAdmin user account:

Email address: admin@otodiginet.com
Password: 
Retype password:

4.2 pgAdmin Application Initialisation

On this stage we will initialize pgAdmin web page, by submitting the following command lines :

$ sudo chown -R apache:apache /var/lib/pgadmin4 /var/log/pgadmin4
$ sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/lib/pgadmin4(/.*)?"
$ sudo restorecon -Rv /var/lib/pgadmin4/
$ sudo restorecon -Rv /var/log/pgadmin4/

Output :

[ramans@localhost ~]$ sudo chown -R apache:apache /var/lib/pgadmin4 /var/log/pgadmin4
[ramans@localhost ~]$ sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/log/pgadmin4(/.*)?"
[ramans@localhost ~]$ sudo restorecon -Rv /var/lib/pgadmin4/
Relabeled /var/lib/pgadmin4 from unconfined_u:object_r:var_lib_t:s0 to unconfined_u:object_r:httpd_sys_rw_content_t:s0
Relabeled /var/lib/pgadmin4/sessions from unconfined_u:object_r:var_lib_t:s0 to unconfined_u:object_r:httpd_sys_rw_content_t:s0
Relabeled /var/lib/pgadmin4/storage from unconfined_u:object_r:var_lib_t:s0 to unconfined_u:object_r:httpd_sys_rw_content_t:s0
Relabeled /var/lib/pgadmin4/pgadmin4.db from unconfined_u:object_r:var_lib_t:s0 to unconfined_u:object_r:httpd_sys_rw_content_t:s0
[ramans@localhost ~]$ sudo restorecon -Rv /var/log/pgadmin4/
Relabeled /var/log/pgadmin4 from unconfined_u:object_r:var_log_t:s0 to unconfined_u:object_r:httpd_sys_rw_content_t:s0
Relabeled /var/log/pgadmin4/pgadmin4.log from unconfined_u:object_r:var_log_t:s0 to unconfined_u:object_r:httpd_sys_rw_content_t:s0

5. Accessing pgAdmin Web Interface

after all the installation steps are passed, then we can try to access pgAdmin web with a browser. The URL will be available at http://<ip_address_or_localhost>/pgadmin4.

pgAdmin 4 web interface
pgAdmin 4 web interface
pgAdmin main dashboard
pgAdmin main dashboard

Conlusion

On this short tutorial, we have learn how to install pgAdmin 4.30 on CentOS 8 opearating system successfully. I hope this tutorial will be useful.

Add a Comment

Your email address will not be published.