How to Install pgAdmin 4 on Ubuntu: A Step-by-Step Guide

pgAdmin 4 is the leading open-source management and development platform for PostgreSQL. Whether you are managing local databases or high-availability production clusters, pgAdmin provides a powerful, intuitive interface to handle your data.

This guide covers the most reliable installation method using the official pgAdmin APT repository, ensuring you stay updated with the latest releases (such as version 9.x) and security patches.

Why Use the Official Repository?

While pgAdmin is available in default Ubuntu software sources, those versions are often outdated. Using the official repository guarantees:

  • Compatibility with the latest PostgreSQL 17 features.
  • Access to the most recent performance improvements and bug fixes.
  • Seamless updates via the standard apt upgrade process.

Step 1: Add the Official pgAdmin Repository

To ensure system integrity, we must first add the pgAdmin public key and link the repository to your Ubuntu distribution.

  1. Install the Public Key: Open your terminal and run the following command to download and store the GPG key:
curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/pgadmin-keyring.gpg

  1. Create the Repository Configuration: Add the repository to your sources list. This command automatically detects your Ubuntu version (e.g., Noble, Jammy):
    sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/pgadmin-keyring.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list'
  1. Update Package Lists:
sudo apt update

Step 2: Choose Your Installation Mode

Ubuntu users can choose between three different deployment modes depending on their workflow:

Mode Command Best For
Desktop sudo apt install pgadmin4-desktop Local development with a dedicated window.
Web sudo apt install pgadmin4-web Remote servers; accessible via any web browser.
Full sudo apt install pgadmin4 Installs both Desktop and Web modes.

Step 3: Configure the Web Interface (Required for Web Mode)

If you installed the web or full version, you must initialize the web server and create your initial login credentials:

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

During this setup, you will be prompted to enter an administrator email and password. Once finished, you can access pgAdmin at http://localhost/pgadmin4.

Critical Security Tips

  • Master Password: Upon launching the Desktop mode for the first time, you will be asked to set a Master Password. This is used to encrypt the saved credentials for your database servers. Keep it safe.
  • Production Stability: If you are managing critical systems like billing or accounting databases, use the Web Mode on a secure internal network. This allows you to manage the database without exposing port 5432 to the public internet.
  • Version Check: Ensure you are running at least pgAdmin v9.x to take full advantage of the latest PostgreSQL optimizations and security protocols.

Summary

Installing pgAdmin 4 on Ubuntu is a straightforward process when using the official community-maintained repositories. With this setup, your environment is ready to handle complex schemas, query debugging, and performance monitoring with ease.

Share this article:
Date :
15 May 2026, 02:58
Author :
Copyright © 2025 Akhmad.dev