How to Install pgAdmin on Debian 11 / Debian 10
pgAdmin is a free and open-source web-based tool for managing PostgreSQL databases, and it includes several features that can help you administer and maintain databases with ease.
With pgAdmin, you can view and edit data in tables, run SQL queries, manage users and permissions, create sequences, etc., all from your web browser
pgAdmin is available for multiple operating systems such as Linux, Windows, and macOS.
Additionally, pgAdmin can also be run as a desktop application.
In this post, we will see how to install pgAdmin on Debian 11 / Debian 10.
Install PostgreSQL Server
First, install PostgreSQL server on your system if you haven’t already installed and above installed on your system.
READ: How To Install PostgreSQL on Debian 11 / Debian 10
Install pgAdmin on Debian 11
Add pgAdmin Repository
Update the repository index and then install a few essential packages.
sudo apt update sudo apt install -y apt-transport-https ca-certificates software-properties-common curl
First, import the pgAdmin signing key to the system.
# Debian 11 curl -fsSL https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/pgadmin-keyring.gpg # Debian 10 curl -fsSL https://www.pgadmin.org/static/packages_pgadmin_org.pub -O- | sudo apt-key add -
Next, add the pgAdmin repository to your system using the below command.
# Debian 11 echo "deb [signed-by=/usr/share/keyrings/pgadmin-keyring.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/bullseye pgadmin4 main" | sudo tee /etc/apt/sources.list.d/pgadmin4.list # Debian 10 echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/buster 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
Install pgAdmin 4 web application with the following command.
sudo apt install -y pgadmin4-web
Setup pgAdmin 4
You will need to set up pgAdmin 4 before accessing it. So, initiate the pgAdmin 4 set up with the below command.
sudo /usr/pgadmin4/bin/setup-web.sh
To complete the setup, you will need to answer a few questions. So, answer as per your requirement.
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 << Type y and press Enter The Apache web server is running and must be restarted for the pgAdmin 4 installation to complete. Continue (y/n)? y << Type y and press Enter Apache successfully restarted. You can now start using pgAdmin 4 in web mode at https://127.0.0.1/pgadmin
Set up PostgreSQL Authentication
PostgreSQL database users can only log in from the Unix socket by default. So, you will need to enable login from all hosts or specific subnet if the pgAdmin4 is installed on another machine. You can enable the MD5 method to ensure the pgAdmin sends encrypted passwords for additional security.
Edit pg_hba.conf
file.
# PostgreSQL 13 sudo nano /etc/postgresql/14/main/pg_hba.conf # PostgreSQL 12 sudo nano /etc/postgresql/13/main/pg_hba.conf
Update the below line shown below.
# TYPE DATABASE USER ADDRESS METHOD # IPv4 local connections: host all all all md5
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 4 web application.
Log in to the pgAdmin4 using the email address and password you have entered during the pgAdmin4 setup.
Upon successful login, you should see the pgAdmin 4 interface.
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 Server
Connection Tab:
Hostname/Address:- Hostname or IP Address of PostgreSQL server. Enter 127.0.0.1 if pgAdmin4 is installed on the PostgreSQL server itself.
Port:- 5432 (Leave default) – Change it if required.
Username:- Username by which you are connecting. In my case, it is postgres.
Password:- Password for the database user. In my case, it is a postgres user’s password.
Click Save to save the changes.
If the connection to the PostgreSQL server is successful, you will see the following page.

Conclusion
That’s All. You have successfully installed pgAdmin on Debian 11 / Debian 10. Also, you have added one of your PostgreSQL instances to manage the database. You can visit pgAdmin 4 documentation for more information.