Skip to content

How to Install pgAdmin 4 on Ubuntu 26.04 & 24.04

Install pgAdmin 4 on Ubuntu 26.04 and 24.04 from the official repository, set up desktop or web mode, and connect it to PostgreSQL.

Steps
5
Category
Databases
Covers
PostgreSQL, Ubuntu
On this page 5 steps

pgAdmin 4 is the most popular graphical tool for managing PostgreSQL. It lets you browse databases, run queries, design tables, manage users and monitor activity from a desktop window or a web browser. This guide shows how to install pgAdmin 4 on Ubuntu 26.04 LTS and Ubuntu 24.04 LTS from the official pgAdmin repository, set up desktop or web mode, and connect it to a PostgreSQL server.

Prerequisites

Step 1 of 5Add the pgAdmin Repository

pgAdmin is not in Ubuntu’s own repositories, and older guides that install pgadmin4-apache2 from the PostgreSQL repository no longer work. The pgAdmin project publishes its own APT repository with builds for Ubuntu 26.04 and 24.04.

Install the tools needed to add the repository:

sudo apt update
sudo apt install curl ca-certificates gnupg

Import the repository’s signing key:

curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg

Add the repository. The lsb_release -cs part inserts your release codename automatically (resolute on 26.04, noble on 24.04):

echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" | sudo tee /etc/apt/sources.list.d/pgadmin4.list
sudo apt update

Step 2 of 5Install pgAdmin 4

Choose the mode that fits how you work:

PackageModeUse it when
pgadmin4-desktopDesktop appYou manage databases from your own Ubuntu desktop
pgadmin4-webWeb app served by ApacheYou want to open pgAdmin in a browser, for example on a server
pgadmin4BothYou want both modes on the same machine

For desktop mode:

sudo apt install pgadmin4-desktop

For web mode:

sudo apt install pgadmin4-web

Step 3 of 5Configure Web Mode

Skip this step if you installed only the desktop app. For web mode, run the setup script. It asks for an email address and password for the first pgAdmin user, then configures Apache:

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

Answer y when it asks to configure the Apache web server and to restart it. If UFW is enabled, allow web traffic:

sudo ufw allow 'Apache'

Now open http://your-server-ip/pgadmin4 in a browser and log in with the email and password you just set. On a server reachable from the internet, put pgAdmin behind HTTPS before you use it with real credentials.

Step 4 of 5Start pgAdmin in Desktop Mode

Open the Activities overview and search for pgAdmin 4. The first launch takes a few seconds while pgAdmin creates its local configuration. You can also start it from a terminal:

/usr/pgadmin4/bin/pgadmin4

Step 5 of 5Connect to a PostgreSQL Server

  1. In the pgAdmin dashboard, click Add New Server, or right-click Servers and choose Register > Server.
  2. On the General tab, enter a name for the connection, such as Local PostgreSQL.
  3. On the Connection tab, enter the host (localhost for a local server), port 5432, the maintenance database (postgres), and a database user name and password.
  4. Click Save. The server appears in the left sidebar with its databases, roles and tablespaces.

A fresh PostgreSQL install has no password for the postgres user. Set one before connecting with password authentication:

sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'your-strong-password';"

Update or Remove pgAdmin

pgAdmin updates arrive through APT with the rest of your system:

sudo apt update && sudo apt upgrade

To remove it, along with the repository entry:

sudo apt remove pgadmin4 pgadmin4-desktop pgadmin4-web
sudo rm /etc/apt/sources.list.d/pgadmin4.list

Conclusion

You installed pgAdmin 4 on Ubuntu from the official pgAdmin repository, chose desktop or web mode, and connected it to PostgreSQL. Because the package comes from the pgAdmin project itself, you get new pgAdmin releases as soon as they are published.

Rahul

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

19 Comments

  1. Hello!
    Your tutorials are great but i am trying to install pgadmin4 in my pc but i am getting this error whenever i execute the first step of installing pgadmin4 saying “Package ‘pgadmin4’ has no installation candidate” and also “Unable to locate package pgadmin4-apache2”.
    I did not understand this error and would appreciate if anyone help me solve this.
    Here is my full error message

    Package pgadmin4 is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘pgadmin4’ has no installation candidate
    E: Unable to locate package pgadmin4-apache2

  2. HI I’m trying to use this tool and I found this error on error.log of apache2

    AttributeError: ‘ReverseProxied’ object has no attribute ‘app’

  3. sir when i open ‘http://127.0.0.1/pgadmin4/’ ,it’s asking me a login name and password. but in the installation process i only gave the password. so how should i login into this now? Is it possible to register again ?
    Looking forward your reply.
    Thanks in advance

  4. Thanks a lot for kind introduction.

    I have a question. I successfully connected the ‘localhost/pgadmin4/browser/#’ on chrome.

    However, when I launched the icon ‘pgAdmin4’ on background screen, I found that the database created when I connected ‘localhost/pgadmin4/browser/#’ did not appeared.

    Could you explaint what the difference is?

  5. When I try to install these tools, I receive this error: The package «pgadmin4» does not have a candidate for installation

  6. Hi.
    I followed the tutorial perfectly
    My problem is that it does not let me perform restauras
    The Pgadmin gives me an error [Errno 2] No such file or directory: ‘python’: ‘python

  7. Hey Stark, I know by now this is probably late but did you confirm that Apache web server was running? Run this command on the terminal and ensure that it is running

    # systemctl status apache2

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top