How to Install pgAdmin 4 PostgreSQL Admin Tool on Ubuntu 24.04

pgAdmin 4 is a popular open-source administration and development platform for PostgreSQL. This guide will walk you through the installation process on Ubuntu 24.04.

Prerequisites

  • Ubuntu 24.04 installed on your machine.
  • Access to a terminal with sudo privileges.

Step 1: Update Your System

Before installing any new software, it’s a good idea to update your package list and upgrade your existing packages. Open your terminal and run:

sudo apt update && sudo apt upgrade -y
    

Step 2: Install Required Dependencies

pgAdmin 4 requires some additional packages. Install them by running:

sudo apt install wget curl ca-certificates gnupg -y
    

Step 3: Add the pgAdmin Repository

Next, you need to add the pgAdmin repository to your system. Run the following commands:

wget --quiet -O - https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/pgadmin.gpg
echo "deb [signed-by=/usr/share/keyrings/pgadmin.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/ubuntu focal pgadmin4 main" | sudo tee /etc/apt/sources.list.d/pgadmin4.list
    

Step 4: Install pgAdmin 4

Now that the repository is added, update your package list again and install pgAdmin 4:

sudo apt update
sudo apt install pgadmin4 -y
    

Step 5: Configure pgAdmin 4

After installation, you need to configure pgAdmin 4. Run the following command:

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

This script will prompt you to set up an email address and password for the pgAdmin web interface.

Step 6: Access pgAdmin 4

Once the setup is complete, you can access pgAdmin 4 by opening your web browser and navigating to:

http://localhost/pgadmin4
    

Conclusion

You have successfully installed pgAdmin 4 on Ubuntu 24.04. You can now use it to manage your PostgreSQL databases easily.