pgAdmin 4 is the most popular graphical tool for managing PostgreSQL. It lets you browse databases, run queries, design tables, manage users and monitor activity from a desktop window or a web browser. This guide shows how to install pgAdmin 4 on Ubuntu 26.04 LTS and Ubuntu 24.04 LTS from the official pgAdmin repository, set up desktop or web mode, and connect it to a PostgreSQL server.
Prerequisites
- Ubuntu 26.04 LTS or Ubuntu 24.04 LTS.
- A user with sudo privileges.
- A PostgreSQL server to connect to, on the same machine or elsewhere. If you need one, see how to install PostgreSQL on Ubuntu 24.04.
Step 1 of 5Add the pgAdmin Repository
pgAdmin is not in Ubuntu’s own repositories, and older guides that install pgadmin4-apache2 from the PostgreSQL repository no longer work. The pgAdmin project publishes its own APT repository with builds for Ubuntu 26.04 and 24.04.
Install the tools needed to add the repository:
sudo apt updatesudo apt install curl ca-certificates gnupg
Import the repository’s signing key:
curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg
Add the repository. The lsb_release -cs part inserts your release codename automatically (resolute on 26.04, noble on 24.04):
echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" | sudo tee /etc/apt/sources.list.d/pgadmin4.listsudo apt update
Step 2 of 5Install pgAdmin 4
Choose the mode that fits how you work:
| Package | Mode | Use it when |
|---|---|---|
| pgadmin4-desktop | Desktop app | You manage databases from your own Ubuntu desktop |
| pgadmin4-web | Web app served by Apache | You want to open pgAdmin in a browser, for example on a server |
| pgadmin4 | Both | You want both modes on the same machine |
For desktop mode:
sudo apt install pgadmin4-desktop
For web mode:
sudo apt install pgadmin4-web
Step 3 of 5Configure Web Mode
Skip this step if you installed only the desktop app. For web mode, run the setup script. It asks for an email address and password for the first pgAdmin user, then configures Apache:
sudo /usr/pgadmin4/bin/setup-web.sh
Answer y when it asks to configure the Apache web server and to restart it. If UFW is enabled, allow web traffic:
sudo ufw allow 'Apache'
Now open http://your-server-ip/pgadmin4 in a browser and log in with the email and password you just set. On a server reachable from the internet, put pgAdmin behind HTTPS before you use it with real credentials.
Step 4 of 5Start pgAdmin in Desktop Mode
Open the Activities overview and search for pgAdmin 4. The first launch takes a few seconds while pgAdmin creates its local configuration. You can also start it from a terminal:
/usr/pgadmin4/bin/pgadmin4
Step 5 of 5Connect to a PostgreSQL Server
- In the pgAdmin dashboard, click Add New Server, or right-click Servers and choose Register > Server.
- On the General tab, enter a name for the connection, such as Local PostgreSQL.
- On the Connection tab, enter the host (
localhostfor a local server), port5432, the maintenance database (postgres), and a database user name and password. - Click Save. The server appears in the left sidebar with its databases, roles and tablespaces.
A fresh PostgreSQL install has no password for the postgres user. Set one before connecting with password authentication:
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'your-strong-password';"
Update or Remove pgAdmin
pgAdmin updates arrive through APT with the rest of your system:
sudo apt update && sudo apt upgrade
To remove it, along with the repository entry:
sudo apt remove pgadmin4 pgadmin4-desktop pgadmin4-websudo rm /etc/apt/sources.list.d/pgadmin4.list
Conclusion
You installed pgAdmin 4 on Ubuntu from the official pgAdmin repository, chose desktop or web mode, and connected it to PostgreSQL. Because the package comes from the pgAdmin project itself, you get new pgAdmin releases as soon as they are published.
How did it make you feel?

Hello!
Your tutorials are great but i am trying to install pgadmin4 in my pc but i am getting this error whenever i execute the first step of installing pgadmin4 saying “Package ‘pgadmin4’ has no installation candidate” and also “Unable to locate package pgadmin4-apache2”.
I did not understand this error and would appreciate if anyone help me solve this.
Here is my full error message
Package pgadmin4 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package ‘pgadmin4’ has no installation candidate
E: Unable to locate package pgadmin4-apache2
please where can I find the url of the PgAdmin?
localhost/pgadmin4
Same here:
AttributeError: ‘ReverseProxied’ object has no attribute ‘app’
HI I’m trying to use this tool and I found this error on error.log of apache2
AttributeError: ‘ReverseProxied’ object has no attribute ‘app’
sir when i open ‘http://127.0.0.1/pgadmin4/’ ,it’s asking me a login name and password. but in the installation process i only gave the password. so how should i login into this now? Is it possible to register again ?
Looking forward your reply.
Thanks in advance
Thanks for the tutorial. It worked for me.
Thanks a lot for kind introduction.
I have a question. I successfully connected the ‘localhost/pgadmin4/browser/#’ on chrome.
However, when I launched the icon ‘pgAdmin4’ on background screen, I found that the database created when I connected ‘localhost/pgadmin4/browser/#’ did not appeared.
Could you explaint what the difference is?
Would this work in non-gui mode (i.e. server mode)?
Yes, pgadmin4 opens in the web browser. So there is no need of desktop system.
When I try to install these tools, I receive this error: The package «pgadmin4» does not have a candidate for installation
i forgot the password how can I reset it
it worked perfectly for me
Hi.
I followed the tutorial perfectly
My problem is that it does not let me perform restauras
The Pgadmin gives me an error [Errno 2] No such file or directory: ‘python’: ‘python
Hey Stark, I know by now this is probably late but did you confirm that Apache web server was running? Run this command on the terminal and ensure that it is running
# systemctl status apache2
La aplicacion esta corriendo perfectamente!!!
>>Use servers IP address or domain name followed by /pgAdmin4 as subdirectory URL.
>>http://example.com/pgAdmin4
This does not work. I tried http://localhost/pgAdmin4 as well as http://127.0.0.1/pgAdmin4
All i get is “Not Found” page.
The url should have pgadmin4. No “A”, just “a”.
Thanks, this detail really helped.