You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

PostgreSQL a popular powerful, and open source object-relational database system with more than 15 years of active development and strong reputation for reliability. pgAdmin is the leading Open Source feature-rich PostgreSQL administration and development platform that runs on Linux, Unix, Mac OS X, and Windows. This tutorial will show you how to install pgAdmin 4 on CentOS 8 Linux.

Features of pgAdmin 4

Features of pgAdmin 4 include:

  • auto-detection and support for objects discovered at run-time
  • a live SQL Query Tool with direct data editing
  • support for administrative queries
  • a syntax-highlighting SQL editor
  • redesigned graphical interfaces
  • powerful management dialogs and tools for common tasks
  • responsive, context-sensitive behavior
  • supportive error messages
  • helpful hints
  • online help and information about using pgAdmin dialogs and tools.

Step 1: Enable EPEL repository

Add EPEL repository using our guide below.

Enable EPEL on CentOS 8

Don’t forget to enable PowerTools repository as it contain the packages we’ll need.

sudo dnf -y install
sudo dnf config-manager --set-enabled PowerTools

Step 2: Install PostgreSQL database server

You need to have PostgreSQL installed on your system before you can install pgAdmin 4. Below are the guides to help you install PostgreSQL:

Install PostgreSQL 13 on CentOS 8

Install PostgreSQL 12 on CentOS 8

How to install PostgreSQL 11 on CentOS 8

Step 3: Install pgAdmin4 on CentOS 8

After installing PostgreSQL, you can begin the installation of pgAdmin 4 on CentOS 8. You need to add PostgreSQL RPM repository, which should have been done while installing PostgreSQL.

sudo dnf -y install

Then install the pgAdmin package:

sudo dnf -qy module disable postgresql
sudo dnf install pgadmin4

Accept installation prompt by pressing the “y” key.

Dependencies resolved.
 Package                                            Architecture          Version                                                Repository                  Size
 pgadmin4                                           x86_64                4.27-1.rhel8                                           pgdg-common                 17 k
Installing dependencies:
 apr                                                x86_64                1.6.3-9.el8                                            AppStream                  125 k
 apr-util                                           x86_64                1.6.1-6.el8                                            AppStream                  105 k
 centos-logos-httpd                                 noarch                80.5-2.el8                                             BaseOS                      24 k
 httpd                                              x86_64                2.4.37-21.module_el8.2.0+494+1df74eae                  AppStream                  1.7 M
 httpd-filesystem                                   noarch                2.4.37-21.module_el8.2.0+494+1df74eae                  AppStream                   36 k
 httpd-tools                                        x86_64                2.4.37-21.module_el8.2.0+494+1df74eae                  AppStream                  103 k
 libsodium                                          x86_64                1.0.18-2.el8                                           epel                       162 k
 mailcap                                            noarch                2.1.48-3.el8                                           BaseOS                      39 k
 mod_http2                                          x86_64                1.11.3-3.module_el8.2.0+486+c01050f0.1                 AppStream                  156 k
 pgadmin4-docs                                      noarch                4.27-1.rhel8                                           pgdg-common                 48 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.3-1.rhel8.1                                        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.3.2-1.rhel8.1                                        pgdg-common                109 k
 pgadmin4-python3-flask-wtf                         noarch                0.14.2-1.rhel8.1                                       pgdg-common                 59 k
 pgadmin4-python3-paramiko                          noarch                2.6.0-3.rhel8                                          pgdg-common                288 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.2.18-1.rhel8                                         pgdg-common                3.9 M
 pgadmin4-python3-sqlparse                          noarch                0.3.0-1.rhel8                                          pgdg-common                 81 k
 pgadmin4-python3-sshtunnel                         noarch                0.1.4-1.rhel8                                          pgdg-common                 45 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.27-1.rhel8                                           pgdg-common                6.3 M
 policycoreutils-python-utils                       noarch                2.9-9.el8                                              BaseOS                     251 k
 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-flask                                      noarch                1:0.12.2-4.el8                                         AppStream                  141 k
 python3-itsdangerous                               noarch                0.24-14.el8                                            AppStream                   31 k
 python3-ldap3                                      noarch                2.8.1-2.el8                                            epel                       535 k
 python3-mako                                       noarch                1.0.6-13.el8                                           AppStream                  157 k
 python3-mod_wsgi                                   x86_64                4.6.4-4.el8                                            AppStream                  2.5 M
 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
Installing weak dependencies:
 apr-util-bdb                                       x86_64                1.6.1-6.el8                                            AppStream                   25 k
 apr-util-openssl                                   x86_64                1.6.1-6.el8                                            AppStream                   27 k
Enabling module streams:
 httpd                                                                    2.4

Transaction Summary
Install  53 Packages

Total download size: 69 M
Installed size: 154 M
Is this ok [y/N]: y

Import GPG when asked:

Total                                                                                                                              26 MB/s |  69 MB     00:02
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) <[email protected]>"
 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

Step 3: Configure pgAdmin 4 on CentOS 8

Now that we have pgAdmin 4 installed, let’s configure it.

1. Start and enable httpd service to start on boot:

sudo systemctl start httpd && sudo systemctl enable httpd

You can confirm service status by running:

$ 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 Wed 2020-01-15 12:59:34 EAT; 6s ago
      Docs: man:httpd.service(8)
  Main PID: 3310 (httpd)
    Status: "Started, listening on: port 80"
     Tasks: 213 (limit: 11512)
    Memory: 36.6M
    CGroup: /system.slice/httpd.service
            ├─3310 /usr/sbin/httpd -DFOREGROUND
            ├─3311 /usr/sbin/httpd -DFOREGROUND
            ├─3312 /usr/sbin/httpd -DFOREGROUND
            ├─3313 /usr/sbin/httpd -DFOREGROUND
            └─3314 /usr/sbin/httpd -DFOREGROUND
 Jan 15 12:59:34 cent8.novalocal systemd[1]: Starting The Apache HTTP Server…
 Jan 15 12:59:34 cent8.novalocal httpd[3310]: Server configured, listening on: port 80
 Jan 15 12:59:34 cent8.novalocal systemd[1]: Started The Apache HTTP Server.

2. Rename pgAdmin Apache configuration sample:

sudo cp /etc/httpd/conf.d/pgadmin4.conf.sample /etc/httpd/conf.d/pgadmin4.conf

Confirm configuration syntax to prevent any errors and restart httpd service.

$ sudo httpd -t
Syntax OK
$ sudo systemctl restart httpd

4. Create pgAdmin data directories:

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

5. Edit and add the following settings. In most cases, the default file locations should be appropriate:

sudo vi /usr/lib/python3.6/site-packages/pgadmin4-web/


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'

6. Run the following command to create the configuration database:

sudo dnf -y install python3-bcrypt python3-pynacl
sudo python3 /usr/lib/python3.6/site-packages/pgadmin4-web/

This will ask you to Enter the email address and the password to use for the initial pgAdmin user account.

Email address: [email protected]
Retype password:<Confirm PASSWORD>
pgAdmin 4 - Application Initialisation

Set permissions for pgAdmin directories to apache user:

sudo chown -R apache:apache /var/lib/pgadmin4 /var/log/pgadmin4

Step 4: Configure SELinux

Set permissions for pgAdmin directories to apache user:

sudo chown -R apache:apache /var/lib/pgadmin4 /var/log/pgadmin4

If you have SELinux running in enforcing mode, create and apply a policy to allow Apache user access pgAdmin directories:

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

Restart httpd service.

sudo systemctl restart httpd

Step 5: Access pgAdmin 4 Web Interface

if you have an active firewall service, allow http port:

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

Open http://servername_or_ip/pgadmin4 to log in to the pgAdmin with the credentials created step 6 above.

pgAdmin centos 7 fedora 29 login

On the first page of pgAdmin, add a PostgreSQL server to administer with pgAdmin by clicking on “Add New Server”. This can be local or a remote PostgreSQL server.

pgAdmin centos 7 fedora 29 add server 01

Under the “General” section, give the server a name & description.

pgAdmin centos 7 fedora 29 addd server 02

Under “Connection” tab, provide access details – DB host, DB user and Password.

pgAdmin centos 7 fedora 29 add server 03

When done, Click Save button to save the configurations. If you were successful adding the server, the name will appear in the left sidebar. Select the server to see database summary information and make changes.

pgAdmin centos 7 fedora 29 dashboard

I hope our article was helpful in installing pgAdmin 4 on CentOS 8.

Other guides on installing pgAdmin 4:

Install pgAdmin4 on CentOS 7 / Fedora

How to Install pgAdmin4 on FreeBSD 12

Install pgAdmin4 on Ubuntu

Install pgAdmin4 on Debian

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF


Please enter your comment!
Please enter your name here