pgAdmin 4 is the leading open-source web-based management tool for PostgreSQL. This guide installs the pgAdmin 4 web version on Ubuntu 24.04 LTS so you can manage databases from a browser.

Tested and valid on:

  • Ubuntu 24.04 LTS

Prerequisites

  • Ubuntu 24.04 LTS server
  • PostgreSQL 16 installed
  • Nginx installed
  • A user with sudo privileges

Step 1 – Add the pgAdmin 4 Repository

Import the pgAdmin GPG key and add the repository:

curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/noble pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list'

Step 2 – Install pgAdmin 4 Web Mode

Update and install the web-mode package:

sudo apt update
sudo apt install pgadmin4-web -y

Step 3 – Run the Setup Script

Configure pgAdmin with an admin email and password:

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

Step 4 – Configure Nginx Proxy (if needed)

The setup script configures Apache by default. For Nginx, add a proxy pass:

location /pgadmin4 {
    proxy_pass http://localhost:5050;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
}

Step 5 – Access pgAdmin 4

Open a browser and navigate to http://your_server_ip/pgadmin4. Log in with the admin credentials from Step 3.

Step 6 – Connect to Your PostgreSQL Server

In the pgAdmin sidebar, right-click ServersRegister → Server. Enter your PostgreSQL connection details and save.

Step 7 – Secure with HTTPS

Enable SSL with Certbot to protect your pgAdmin login:

sudo certbot --nginx -d your_domain.com

Conclusion

pgAdmin 4 is now accessible on Ubuntu 24.04 LTS. You can manage PostgreSQL 16 databases, run queries, view table data, and monitor server activity all from the browser interface.