How to install pgAdmin on Ubuntu 22.04

The pgAdmin is the most advanced tool used to manage the administrative tasks of PostgreSQL databases. The pgAmdin tool provides the Graphical User Interface to interact with PostgreSQL.  Moreover, the local and remote sessions of PostgreSQL can also be managed using pgAdmin.  

Considering its importance, this post will demonstrate how to install pgAdmin on Ubuntu 22.04.

How to Install pgAdmin on Ubuntu 22.04?

The method provides a step by step instructions to install pgAdmin on Ubuntu 22.04. Before getting into the installation, it is required that your system must have the “curl” utility. To install it, use the below-mentioned command:

$ sudo apt install curl

Now, head over to the further installation steps.

Step 1: Add the GPG Key of pgAdmin

Like most of the packages, first, the GPG key of the pgAdmin should be added in Ubuntu by running the command:

$ sudo curl | sudo apt-key add

Step 2: Add the pgAdmin Repository

After adding the GPG keys, next step is to add the repository of pgAdmin in |Ubuntu and also update the repository using the command:

$ sudo sh -c 'echo "deb$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && sudo apt update'

Step 3: Install pgAdmin

When done with the updating repository, use the command below-mentioned to install both desktop and web mode:

$ sudo apt install pgadmin4 -y

Here, a point should be mentioned that it’s not compulsory to install both desktop and Web modes. If only desktop mode is supposed to be installed, then use the command:

$ sudo apt install pgadmin4-desktop -y

And if the users want to install the web-support of pgAdmin4, then run the command:

$ sudo apt install pgadmin4-web -y

Step 3 (only for pgAdmin-web): Configure the User Account

This step only refers to those that have installed the web support of pgAdmin. By doing so, the user account can be secured. Resultantly, any unauthorized user will not be able to access your pgAdmin. Copy/Paste the command and hit enter:

$ sudo /usr/pgadmin4/bin/

It will ask for the email address and password:

Allow the initialization and also restart the Apache web server by typing the “y”:

Step 4: Access the pgAdmin Web Interface

Then, open the browser and use the mentioned address in the above command result:

Enter the set email and password to access the pgAdmin:

The pgAdmin is ready to use.

How to Remove pgAdmin on Ubuntu 22.04?

If you are no more using pgAdmin4 on your Ubuntu 22.04 and want to remove it. Then, use the command below:

$ sudo apt purge pgadmin4 -y

The pgAdmin has been removed from Ubuntu 22.04.

That’s all from this guide!


To install pgAdmin on Ubuntu, run the command “sudo apt install pgadmin4 -y” in the terminal to install both web and desktop modes. However, the users can install either the desktop or the web version explicitly. This article has demonstrated the detailed method to install pgAdmin4 on Ubuntu 22.004.