Install pgAdmin 4 on Debian 12

|
Last Updated:
|
|

This tutorial will take you through how to install pgAdmin 4 on Debian 12. pgAdmin 4 is a popular graphical tool with an intuitive user interface for administering PostgreSQL databases.

Installing pgAdmin 4 on Debian 12

Install PostgreSQL on Debian 12

Since pgAdmin is a graphical PostgreSQL administration tool, you need to be already running PostgreSQL.

Check the guides on the link below on how to install PostgreSQL on Linux systems.

How to install PostgreSQL on Linux

Next, you can now proceed to install pgAdmin 4 on Debian as follows;

Install pgAdmin APT Repository

Default repos do not provide pgAdmin packages. Hence, you need to install pgAdmin repository as follows;

echo \
"deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" \
> /etc/apt/sources.list.d/pgadmin4.list

Install pgAdmin Repository GPG signing Key

Install the public key for the repository using the command below;

apt install gnupg2 curl
curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub \
| sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/packages-pgadmin-org.gpg

Install pgAdmin 4

Now, update system package cache and install pgAdmin on Debian 12;

apt update

pgAdmin4 is primarily a desktop application. There also exist a web based version.

Install for both desktop and web modes:

apt install pgadmin4

If you want, you can install for desktop mode only:

apt install pgadmin4-desktop

Or Install for web mode only;

apt install pgadmin4-web

Using pgAdmin Desktop Version

If you installed the desktop app version, then you should be able to launch it from the applications menu;

pgadmin desktop

Launch it and give it a few to start.

Once it started, then, pgAdmin4 desktop dashboard;

Install pgAdmin 4 on Debian 12

Click Add New Server under the dashboard to connect to your PostgreSQL database.

Under General tab, enter the name of the connection.

enter connection name

Under Connections tab, set the database connection details;

  • address of the database server
  • port
  • credentials
database connection details

Save the connection.

pgadmin database access

Select the database and click SQL tab to run the queries.

Using pgAdmin Web Version

If you want to use the pgAdmin web version, run the command below to set it up.

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

Go through the prompts to setup the login credentials, and setup pgAdmin web server.


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: 
Retype password:
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 http://127.0.0.1/pgadmin4

You can now access your pgAdmin from the browser on the local system using the addresses provided above, http://127.0.0.1/pgadmin4.

pgadmin web interface

Login and follow the same procedure as above to add the server and login to the PostgreSQL database.

Conclusion

That concludes our guide on how to install pgAdmin 4 on Debian 12. You can now administer PostgreSQL with ease.

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
Kifarunix
Linux Certified Engineer, with a passion for open-source technology and a strong understanding of Linux systems. With experience in system administration, troubleshooting, and automation, I am skilled in maintaining and optimizing Linux infrastructure.

Leave a Comment