How to Install pgAdmin on Ubuntu 22.04 / Ubuntu 20.04 | Holhol24


pgAdmin is an open-source web-based management tool for managing PostgreSQL databases. It includes several features that can help you easily administer and maintain PostgreSQL databases.

With pgAdmin, you can view and edit data in tables, run SQL queries, manage users and permissions, create sequences, etc., over a web browser

pgAdmin is available for multiple operating systems such as Linux, Windows, and macOS.

This post will show you how to install pgAdmin on Ubuntu 22.04 / Ubuntu 20.04.

Install PostgreSQL Server

First, install the PostgreSQL server on your system if you haven’t already installed it.

READ: How to install PostgreSQL on Ubuntu 22.04

READ: How to install PostgreSQL on Ubuntu 20.04

Install pgAdmin on Ubuntu 22.04

Add pgAdmin Repository

First, import the pgAdmin signing key to the system.

wget -qO - | sudo gpg --dearmor -o  /usr/share/keyrings/pgadmin-keyring.gpg

Next, add the pgAdmin repository to your system using the below command.

echo "deb [signed-by=/usr/share/keyrings/pgadmin-keyring.gpg] pgadmin4 main" | sudo tee /etc/apt/sources.list.d/pgadmin4.list

Install pgAdmin 4

Once you have added the repository, run the following command to update the repository index.

sudo apt update

Then, install pgAdmin with the following command.

sudo apt install -y pgadmin4-web

Setup pgAdmin 4

First, you will need to set up pgAdmin before accessing it. So, initiate the pgAdmin set up with the below command.

sudo /usr/pgadmin4/bin/

To complete the setup, you will need to answer a few questions.

Setting up pgAdmin 4 in web mode on a Debian based platform...
Creating configuration database...
NOTE: Configuring authentication for SERVER mode.

Enter the email address and password to use for the initial pgAdmin user account:

Email address: [email protected]
Password: xxx
Retype password: xxx
pgAdmin 4 - Application Initialisation

Creating storage and log directories...
We can now configure the Apache Web server for you. This involves enabling the wsgi module and configuring the pgAdmin 4 application to mount at /pgadmin4. Do you wish to continue (y/n)? y 
The Apache web server is running and must be restarted for the pgAdmin 4 installation to complete. Continue (y/n)? y 
Apache successfully restarted. You can now start using pgAdmin 4 in web mode at

Set up PostgreSQL Authentication

PostgreSQL database users can only log in from the localhost by default, and you will not be able to manage the database server installed on a remote system with pgAdmin. So, enable the user’s login from all hosts or specific subnet on PostgreSQL for pgAdmin to make a successful connection.

Edit pg_hba.conf file.

sudo nano /etc/postgresql/14/main/pg_hba.conf

Update the below line shown below.

# TYPE  DATABASE        USER            ADDRESS                 METHOD
# IPv4 local connections:
host     all            all              all                     md5

Finally, restart the PostgreSQL service.

sudo systemctl restart postgresql

Access pgAdmin 4

Open a web browser and go to the following URL to access the pgAdmin.

Log in to the pgAdmin using the email address and password you have entered during the pgAdmin setup.

Upon successful login, you should see the pgAdmin web interface.

pgAdmin 4 Home Page

To manage a PostgreSQL server, you must add a new server by clicking on Add New Server on the home page.

General Tab:

Name:- Name your PostgreSQL instance

Connection Tab:

Hostname/Address: Hostname or IP Address of PostgreSQL server. Enter if pgAdmin is installed on the PostgreSQL server itself.
Port: 5432 (Leave default) – Change it if required.
Username: PostgreSQL DB username
Password: Password for the database user.

Click Save to save the changes.

You will see the following page if the connection to the PostgreSQL server is successful.

pgAdmin 4 DB Dashboard
pgAdmin 4 DB Dashboard


That’s All. I hope you have learned how to install pgAdmin on Ubuntu 22.04 / Ubuntu 20.04. Additionally, you can visit pgAdmin documentation for more information.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More