How to Install pgAdmin on Ubuntu 24.04

Want to manage your PostgreSQL databases with a powerful graphical interface? In this guide, you will learn how to install pgAdmin on Ubuntu 24.04 and connect it to your existing PostgreSQL server.

pgAdmin stands as the most popular open-source administration platform for PostgreSQL databases, offering an intuitive interface that simplifies complex database management tasks. Whether you are handling routine maintenance or performing advanced database operations, pgAdmin’s comprehensive toolset makes database administration more efficient and accessible.

Prerequisites

  • Pre-Install Ubuntu 24.04
  • Sudo User with admin access
  • Internet Access
  • Pre-Install PostgreSQL

Without any delay, lets quickly jump into pgadmin installation steps on Ubuntu 24.04

1) Install Curl Utility

We need curl command line utility to install public keys of package repository. So, open the terminal and run below apt command,

$ sudo apt update && sudo apt install curl -y

2) Add pgAdmin APT Repository

Before installing pgAdmin, we need to add its official repository to Ubuntu 24.04 since it’s not included in the default Ubuntu repositories. Let’s start by importing pgAdmin’s official GPG key to verify package authenticity. Run the following curl command to download and add the repository’s public key:

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

Now create the repository configuration file using beneath command.

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

Add PgAdmin APT Repository Ubuntu 24.04

3) Install pgAdmin on Ubuntu 24.04

Once you are done with setup of pgAdmin repository then run following apt command to install pgAdmin for both desktop and web modes.

$ sudo apt install pgadmin4 -y

Install PgAdmin on Ubuntu 24.04

4) Configure User Account for pgAdmin Web Interface

The pgAdmin4 installation includes a critical security component – the setup-web.sh script, located at /usr/pgadmin4/bin/setup-web.sh. This script plays an essential role in securing your pgAdmin web interface by configuring user authentication. When you run this script, it guides you through creating administrator credentials, ensuring that only authorized users can access your database management interface. This authentication layer is crucial for protecting your PostgreSQL databases from unauthorized access and potential security breaches.

Run the script from the terminal.

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

Creating User for PgAdmin Interface Ubuntu 24.04

Script will prompt you to enter email address, password and restart Apache service.

5) Access pgAdmin Web Interface

With the setup complete, you can now access pgAdmin through your web browser. Open your preferred web browser and enter the following URL in the address bar:

http://<IP-Address-of-Your-System>/pgadmin4

You will be prompted to log in using the email address and password you provided during the setup process.

PgAdmin4-Login-Page-Ubuntu-22-04

Upon successful login, you will gain access to the PGAdmin interface, where you can start managing your PostgreSQL databases with ease.

pgAdmin-Graphical-User-Interface-Ubuntu-22-04

6) Connect to PostgreSQL From pgAdmin

Now that you’re logged in to pgAdmin, it’s time to connect it to your PostgreSQL database server. Follow these steps:

a ) Right Click on Servers Icon, choose Register and then server as shown below:

Register-PostgreSQL-Database-pgAdmin-Ubuntu

b) Fill in the following details in General and Connection tab

  • Registered Server Name
  • Hostname/address: Enter the IP address or hostname of your PostgreSQL server.
  • Port: By default, PostgreSQL listens on port 5432.
  • Maintenance database: Enter the name of the default database you want to connect to.
  • Username: Enter the username of your PostgreSQL user with appropriate privileges.
  • Password: Enter the password associated with the username.

Server-Registration-Name-pgAdmin-Interface

PostgreSQL-Connection-Details-pgAdmin-GUI-Ubuntu-22-04

Click “Save” to register the server to pgAdmin.

Once the server is added, you can expand it in the pgAdmin dashboard to access the databases, schemas, tables, and other objects within your PostgreSQL server. You can perform various administrative tasks, execute queries, and manage your databases efficiently using pgAdmin’s intuitive interface.

pgAdmin-Interface-After-Connecting-PostgreSQL-Server

Thank you for following this guide on installing pgAdmin on Ubuntu 24.04! I hope these instructions have helped you set up your PostgreSQL database management interface successfully. If you encounter any issues during the installation process or have questions about using pgAdmin, please don’t hesitate to leave a comment below. Your feedback helps us improve and assists other users facing similar challenges.

2 thoughts on “How to Install pgAdmin on Ubuntu 24.04”

  1. Need Help

    As a prerequisite, I installed PostgreSQL, using your instructions.

    I then followed your instructions to install pgAdmin.
    When I execute Step 3 “sudo apt install pgadmin4 -y”, the output says “Package ‘pgadmin4’ has no installation candidate”

    Can you help me fix this please.
    I placed all of the steps and output below:

    Thanks,
    Robert

    rbrown@HiveMQ:~$ sudo apt update && sudo apt install curl -y
    Hit:1 https://dl.google.com/linux/chrome/deb stable InRelease
    Hit:2 http://security.ubuntu.com/ubuntu noble-security InRelease
    Hit:3 http://us.archive.ubuntu.com/ubuntu noble InRelease
    Hit:4 http://us.archive.ubuntu.com/ubuntu noble-updates InRelease
    Hit:5 http://apt.postgresql.org/pub/repos/apt noble-pgdg InRelease
    Hit:6 http://us.archive.ubuntu.com/ubuntu noble-backports InRelease
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    All packages are up to date.
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    The following NEW packages will be installed:
    curl
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 227 kB of archives.
    After this operation, 532 kB of additional disk space w
    ill be used.
    Get:1 http://us.archive.ubuntu.com/ubuntu noble-updates/main amd64 curl amd64 8.5.0-2ubuntu10.1 [227 kB]
    Fetched 227 kB in 1s (383 kB/s)
    Selecting previously unselected package curl.
    (Reading database ... 151349 files and directories currently installed.)
    Preparing to unpack .../curl_8.5.0-2ubuntu10.1_amd64.deb ...
    Unpacking curl (8.5.0-2ubuntu10.1) ...
    Setting up curl (8.5.0-2ubuntu10.1) ...
    Processing triggers for man-db (2.12.0-4build2) ...
    rbrown@HiveMQ:~$ curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg
    rbrown@HiveMQ:~$ sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
    Hit:1 http://us.archive.ubuntu.com/ubuntu noble InRelease
    Hit:2 http://us.archive.ubuntu.com/ubuntu noble-updates InRelease
    Hit:3 https://dl.google.com/linux/chrome/deb stable InRelease
    Hit:4 http://us.archive.ubuntu.com/ubuntu noble-backports InRelease
    Hit:5 http://security.ubuntu.com/ubuntu noble-security InRelease
    Hit:6 http://apt.postgresql.org/pub/repos/apt noble-pgdg InRelease
    Get:7 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/noble pgadmin4 InRelease [4,217 B]
    Fetched 4,217 B in 1s (2,865 B/s)
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    All packages are up to date.
    rbrown@HiveMQ:~$ sudo apt install pgadmin4 -y
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    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

    1. Pradeep Kumar

      Hi Robert,

      As I can see you are trying to install pgadmin4 on Ubuntu 24.04 but it is not yet supported by Ubuntu 24.04 that’s why you are getting above error.

      We are expecting that it will be supported by June but till that time you can follow the below workaround.

      1) Use mantic instead of noble
      2) Make sure python3.11 is installed.

      $ sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/mantic pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
      $ sudo apt install pgadmin4
      $ sudo add-apt-repository ppa:deadsnakes/ppa
      $sudo apt update
      $ sudo apt install python3.11

Leave a Comment

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