How to Install PgAdmin 4 Debian 10

pgAdmin is an open-source, powerful, and feature-rich graphical user interface (GUI) administration and management tool for the PostgreSQL database. Currently, it 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.

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 is a major release (and a complete rewrite) of pgAdmin, built using Python and Javascript/jQuery, and a desktop runtime written in C++ with Qt. pgAdmin 4 immensely enhances on pgAdmin 3 with updated user interface(UI) elements, multi-user/web deployment options, dashboards, and more modern and elegant design.

In this article, we will show you how to install pgAdmin 4 on Debian 10 system to provide secure, remote access to PostgreSQL databases.

This guide assumes that you already have PostgreSQL 9.2 or higher installed and configured on your Debian 10 server, otherwise to install it, follow our guide: How to Install PostgreSQL 11 on Debian 10.

Installing pgAdmin 4 in Debian 10

Debian 10 ships with pgAdmin 3 by default. To install pgAdmin 4, you need to enable the PostgreSQL Global Development Group (PGDG) APT repository (which contains PostgreSQL packages for Debian and Ubuntu) on your system.

# apt-get install curl ca-certificates gnupg
# curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

Then create a repository file called /etc/apt/sources.list.d/pgdg.list.

# vim /etc/apt/sources.list.d/pgdg.list

And add the following line in the file.

deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main

Save the changes and exit the file.

Now update the APT package cache (which is a mandatory step), and install the pgAdmin 4 package as follows. The pgadmin4-apache2 package is the WSGI application.

# apt-get update
# apt-get install pgadmin4  pgadmin4-apache2
Install Pgadmin 4 on Debian 10
Install Pgadmin 4 on Debian 10

During the package installation, you will be asked to set an email address for the pgAdmin web interface initial user account. This email will work as the account name, provide it and press Enter.

Add Email to PgAdmin
Add Email to PgAdmin

You will also be asked to set a password for the pgadmin4 initial user account. Provide a secure and strong password, then click Enter to proceed.

Set Pgadmin User Password
Set Pgadmin User Password

Once the packages are installed, the installer activates the systemd to start the Apache2 service and enables it to automatically start at system startup, every time the system is rebooted.

You can check the status of the service with the following command to ensure that it is up and running.

# systemctl status apache2 
Check Apache2 Status
Check Apache2 Status

On Debian 10, the pgAdmin 4 WSGI application is configured to work with Apache HTTP server by default using the /etc/apache2/conf-available/pgadmin4.conf configuration file.

Before you can access the pgadmin4 web interface, if you have the UFW firewall running (it is usually disabled by default), you need to open port 80 (HTTP) to allow incoming traffic on Apache service as follows.

# ufw allow 80
# ufw allow 443
# ufw status

Accessing the pgAdmin 4 Web Interface

Now you can access the pgAdmin 4 web interface. Open a web browser and point it to the following address and click Enter.

http://SERVER_IP/pgadmin4
OR
http://localhost/pgadmin4

Once the pgAdmin 4 web login interface appears, enter the email address and password that you set earlier on to authenticate. Then click log in.

Pgadmin Login
Pgadmin Login

After a successful login, you will land at the pgAdmin4 web interface default dashboard. To connect to a database server, click on Add New Server.

Pgadmin Dashboard
Pgadmin Dashboard

Then add the new server connection name and a comment. And click on the Connection Tab to provide the connection details I.e hostname, database name, database username, and password as shown in the following screenshot. Once you are done, click Save.

Pgadmin New Server Connection Name
Pgadmin New Server Connection Name
Pgadmin New Connection Details
Pgadmin New Connection Details

Under the Browser tree, you should now have at least one server connection showing the connection name, number of databases, roles, and table space. Double click on the Database link to view the server performance overview under the Dashboard.

Pgadmin Server Performance Overview
Pgadmin Server Performance Overview

pgAdmin Homepage: https://www.pgadmin.org/

That’s all! pgAdmin 4 vastly improves on pgAdmin 3 with several new features, improvements, and bug fixes. In this guide, we showed how to install and configure pgAdmin 4 on Debian 10 server. If you have any queries, reach us via the comment form below.

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

13 thoughts on “How to Install PgAdmin 4 Debian 10”

    • @Delphine,

      The problem occurs due to the missing repository for pgadmin in your local machine. To solve the issue, do the following below;

      # curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
      # sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list'
      
      Reply
  1. Please help me…

    After the installation, I have lost the password for pgAdmin 4.

    Tell me how to bypass registration on the page http://localhost/pgadmin4.

    Reply
    • @vlad

      I don’t think you can bypass the login feature. The only way is to use the password recovery feature which can only work if you have a working mail service.

      Reply
  2. Aaron,

    Two days ago, we are unable to run pgAdmin4 on my 18.04.5 LTS server. I was presented with a “blank” page after login. We tried different browsers on different OS with the same issue. I posted the issue in the pgadmin-support list group, with the subject title “pgAdmin4 presents blank screen after login.”

    One response from the community asked me to send in the pgAdmin4.log file by enabling the logging per instruction https://www.pgadmin.org/faq/#8.

    But unfortunately, I could not locate where “config.py” was or where pgAdmin was installed. I’d highly appreciate it if you could provide some pointer to either this issue or where I may turn on the logging.

    Cheers,

    Bo

    Reply
  3. Hi there, I am trying to install pgAdmin4 on an 18.04 ubuntu server. When I tried to “apt install pgadmin4 pgadmin4-apache2” I ran into the following error:

    The following packages have unmet dependencies:
     pgadmin4 : Depends: libqt5core5a (>= 5.11.0~rc1) but 5.9.5+dfsg-0ubuntu2.5 is to be installed
     pgadmin4-common : Depends: python3-psycopg2 (>= 2.7.4) but it is not going to be installed
                       Recommends: python3-psycopg2 (>= 2.8) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    

    I appreciate any suggestions.

    Cheers

    Reply
    • @Bo

      Do the following.

      $ sudo apt-get install curl ca-certificates gnupg
      $ curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
      

      Create /etc/apt/sources.list.d/pgdg.list file with this line in it:

      deb http://apt.postgresql.org/pub/repos/apt bionic-pgdg main
      

      Save the file and close it.

      Then run these commands to install pgadmin4:

      $ sudo apt-get update
      $ apt-get install pgadmin4  pgadmin4-apache2
      
      Reply
      • That did it! What do I need to do if any when a new release of pgAdmin4 is out?

        The reason I am asking this question is that for about a year and a half, I have been using the containerized deployment. Since I never could get the volume-mapping working, each time when I want to upgrade, I lost my history, connections, settings, etc.

        Thank you for sharing this great post and your support!

        Bo

        Reply

Leave a Reply to Ravi Saive Cancel reply

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.