Install PgAdmin 4 on Ubuntu: A Step-by-Step Guide

Updated

pgAdmin install ubuntu

Install pgAdmin 4 on Ubuntu from the PostgreSQL project’s own APT repository. Copy this:

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

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
sudo apt install pgadmin4-desktop      # or pgadmin4-web, see below

Do not use https://www.pgadmin.org/$(lsb_release -cs) pgadmin4 main. That host does not serve an APT repository. Checked on 10 August 2026, both https://www.pgadmin.org/dists/noble/Release and https://www.pgadmin.org/noble/dists/pgadmin4/Release return HTTP 404, so apt update can only fail against it. The GPG key URL in the first command is right, and the commands use a signed-by keyring rather than the deprecated apt-key.

Which Ubuntu releases still have packages

There is no 20.04 build. The block below is the repository’s directory listing as I read it on 10 August 2026. On 12 October 2026 the listing holds only bookworm/, jammy/, noble/, resolute/ and trixie/, each with a Release file; bullseye, oracular, plucky and questing now return HTTP 404. The Ubuntu releases with packages are 22.04 (jammy), 24.04 (noble) and 26.04 (resolute).

bookworm/  bullseye/  jammy/  noble/  oracular/  plucky/  questing/  resolute/  trixie/

focal (20.04) is absent, so lsb_release -cs on a 20.04 box produces a repository path that does not exist. The Debian codenames are in the same tree; the same .list line works there.

On 12 October 2026 the newest version in that repository is pgAdmin 4 9.18 (the Release files are dated 17 September 2026); the macOS install was run on 9.17. The dependency lines and the Apache configuration below were read from 9.17, and in 9.18 the same packages declare the same dependencies pinned to (= 9.18), and the Apache configuration file is identical.

apt install pgadmin4 installs Apache on your server

Running sudo apt install -y pgadmin4, then launching pgadmin4 and browsing to http://localhost:5050 mixes two different products.

pgadmin4 is a meta-package. From the repository index:

Package: pgadmin4       Depends: pgadmin4-server (= 9.17), pgadmin4-desktop (= 9.17), pgadmin4-web (= 9.17)
Package: pgadmin4-web   Depends: pgadmin4-server (= 9.17), apache2, libapache2-mod-wsgi-py3

So installing pgadmin4 on a headless server pulls in a desktop application and Apache. Pick one:

  • Desktop mode — sudo apt install pgadmin4-desktop, then launch pgAdmin 4 from your applications menu. It opens as an application window. There is no localhost:5050 to browse to; that port belongs to the Python server you get when running pgAdmin from source or pip, not to the Debian packages.
  • Web mode — sudo apt install pgadmin4-web, then sudo /usr/pgadmin4/bin/setup-web.sh. That script creates the configuration database, prompts for the initial administrator email and password, enables mod_wsgi and the shipped Apache conf, and restarts Apache. Its closing message names the URL: http://127.0.0.1/pgadmin4.

Do not leave web mode on plain HTTP

This is the whole Apache configuration the package installs, read out of pgadmin4-web_9.17-1.noble_all.deb:

WSGIDaemonProcess pgadmin processes=1 threads=25 python-home=/usr/pgadmin4/venv
WSGIScriptAlias /pgadmin4 /usr/pgadmin4/web/pgAdmin4.wsgi

<Directory /usr/pgadmin4/web/>
    WSGIProcessGroup pgadmin
    WSGIApplicationGroup %{GLOBAL}
    Require all granted
</Directory>

pgAdmin itself requires a login, so this is not an open admin panel — but Require all granted plus the default Apache virtual host means /pgadmin4 answers on every address the machine listens on, over unencrypted HTTP. The first thing you do in that form is type a database superuser password. Before exposing it, terminate TLS in front of it or bind it to localhost and reach it over an SSH tunnel:

ssh -N -L 8080:127.0.0.1:80 you@dbhost      # then http://127.0.0.1:8080/pgadmin4

What was not tested

Nothing here was installed. This machine is macOS with no Linux host and no container runtime, so no apt command in this article was executed. What was executed is the evidence for every factual claim: the HTTP status of the pgadmin.org repository URL, the list of supported codenames, the package versions and dependencies from the repository index, and the contents of setup-web.sh and the Apache conf, extracted from the real .deb with ar and tar. A script that installs nothing repeats the repository probes, the index lookups and the .deb extraction in a temporary directory it removes on exit, asserts that focal is missing, and skips every check when offline. Whether pgAdmin 9.17 runs well on your desktop is a claim this page does not make; the Mac page has a live install on it.

Photo of author
Sudhir P. founded HeatWare.com in 1999 and has built and operated it full-stack ever since; it is now used by more than 88,000 people. He writes here about the PostgreSQL, MySQL, Linux and DevOps work that keeps it running. Articles are rewritten only after the commands in them have actually been run, and the verification scripts are published alongside them so anyone can check the claims. Reach him at blog@heatware.net.