PgDeck

PostgreSQL client for Ubuntu

PostgreSQL clients on Ubuntu.

Ubuntu's packaging is helpful right up to the point where it surprises you: the default version trails upstream by a year or more, and the authentication that makes local access effortless is also what blocks every GUI client.

Short answer: apt install postgresql-client gives you psql alone; postgresql installs the server too. Ubuntu's default version lags upstream, so add the PGDG repository if you need a current release. The peer authentication Ubuntu configures means sudo -u postgres psql works with no password while a GUI client is rejected — set a password with \password to fix it.

PgDeck PostgreSQL desktop client with schema navigation, table filtering, row editing, and SQL tools

Why developers use PgDeck

PgDeck is shaped around PostgreSQL tasks that happen every day: connect, inspect, filter, edit, query, manage structure, copy, and export.

postgresql-client installs psql without a server
PGDG's apt repository carries every supported major version
Peer authentication is why psql works and a GUI client does not
pg_lsclusters shows every version and its port
AppImages on recent Ubuntu often need libfuse2

Secure connections

Save PostgreSQL connection details with encrypted passwords, SSL settings, URL import, testing, search, edit, and delete actions.

Schema and data grid

Browse schemas and tables, search the table list, pin favorites, filter rows, sort columns, resize columns, and paginate results.

SQL workspace

Run SELECT and non-SELECT statements from multi-tab SQL editors with syntax highlighting and interactive query results.

Staged editing

Edit cells, add rows, duplicate rows, set NULL, stage deletes, review pending changes, and commit everything in one transaction.

Install and connect a PostgreSQL client on Ubuntu

  1. Install the client, the server, or both

    postgresql-client installs psql and the command-line tools with no server. postgresql installs the server as well and starts it. If you only need to connect to a database elsewhere, install the client package — there is no reason to run a local server you will not use.

    # Just psql and the client tools
    sudo apt install postgresql-client
    
    # Server as well
    sudo apt install postgresql postgresql-contrib
  2. Add the PGDG repository for a current version

    Ubuntu ships whatever PostgreSQL version was current when that release froze, which can be a year or more behind. The PostgreSQL project's own apt repository carries every supported major version, and mixing it with Ubuntu's packages is well supported.

    sudo apt install -y postgresql-common
    sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
    sudo apt install -y postgresql-17
  3. Check the cluster is running

    Debian and Ubuntu wrap PostgreSQL in a cluster system, so you can run several versions side by side. pg_lsclusters shows each one with its version, port, and status — the second cluster listens on 5433, which explains a surprising number of connection problems after an upgrade.

    pg_lsclusters
    sudo systemctl status postgresql
    
    # Per-cluster control
    sudo pg_ctlcluster 17 main start
  4. Set a password to unblock GUI clients

    Ubuntu configures peer authentication for local socket connections, which trusts your system user and never asks for a password. That is why sudo -u postgres psql works instantly. A GUI client connects over TCP to localhost, which uses scram instead — and the postgres role has no password set, so it is rejected. Set one.

    sudo -u postgres psql
    \password postgres
    \q
  5. Create your own role and database

    Working as the postgres superuser for application development is a habit worth not forming. Create a role matching your Linux username and a database owned by it, and psql with no arguments will then connect to your own database as yourself.

    sudo -u postgres createuser --interactive --pwprompt $USER
    sudo -u postgres createdb -O $USER $USER
    
    psql   # now connects as you, to your database
  6. Add a GUI client

    pgAdmin and DBeaver are both in apt or available as packages, and Beekeeper Studio ships a .deb. PgDeck is distributed as an AppImage, so there is no repository to add — make it executable and run it. If it will not start, install libfuse2, which several recent Ubuntu releases no longer ship by default.

    chmod +x PgDeck-Linux-*.AppImage
    ./PgDeck-Linux-*.AppImage
    
    # If it fails to start:
    sudo apt install libfuse2

Peer authentication, and why it confuses everyone

Ubuntu sets local connections to peer, which checks your operating system username against the requested database role and skips passwords entirely. It makes sudo -u postgres psql work with no setup, and it means the postgres role usually has no password at all. Any client connecting over TCP to 127.0.0.1 takes a different pg_hba.conf path requiring scram, and fails. The fix is to set a password, not to change the authentication method.

Debian's cluster system

Ubuntu and Debian can run several PostgreSQL major versions simultaneously, each as a named cluster with its own port and data directory. The first is 5432, the second 5433, and so on. After a major upgrade this is the usual cause of connecting successfully to an empty database: you are on the new cluster while your data is still in the old one. pg_lsclusters shows the whole picture.

Where the configuration files live

Not where upstream documentation says. Ubuntu puts them under /etc/postgresql/<version>/<cluster>/, so postgresql.conf and pg_hba.conf for a default PostgreSQL 17 install are in /etc/postgresql/17/main/. Data lives separately under /var/lib/postgresql/<version>/<cluster>/. SHOW config_file inside psql tells you exactly which file the running server loaded.

Version skew between client and server

A newer psql talks to an older server without trouble, but pg_dump does not work the other way: dumping from a server newer than your pg_dump fails outright, and that is deliberate rather than a bug. If you back up a PostgreSQL 17 server from a machine with Ubuntu's older client package, install the matching postgresql-client-17 from PGDG.

Do not enable trust to make the error go away

Searching this problem turns up advice to set trust in pg_hba.conf, which does stop the error — by accepting any connection with no password at all. On a laptop that is merely bad practice; on anything reachable over a network it hands over the database. Setting a password takes one command and is the correct fix.

How do I install a PostgreSQL client on Ubuntu?

sudo apt install postgresql-client installs psql and the command-line tools without a server. sudo apt install postgresql installs the server as well. For a version newer than Ubuntu ships, add the PostgreSQL project's PGDG apt repository first.

Why does psql work but my GUI client is rejected?

Ubuntu configures peer authentication for local socket connections, which trusts your system user and never asks for a password. A GUI client connects over TCP to localhost, which requires scram — and the role usually has no password set. Run sudo -u postgres psql then \password postgres to set one.

How do I get a newer PostgreSQL version on Ubuntu?

Add the PGDG repository using the apt.postgresql.org.sh script from the postgresql-common package, then install the version you want, for example postgresql-17. It coexists with Ubuntu's packages through the Debian cluster system.

Where is pg_hba.conf on Ubuntu?

Under /etc/postgresql/<version>/<cluster>/, so /etc/postgresql/17/main/pg_hba.conf for a default PostgreSQL 17 install — not in the data directory as upstream documentation suggests. Run SHOW hba_file inside psql to see the exact path in use.

Why does my AppImage database client not start on Ubuntu?

AppImages mount themselves using FUSE 2, which several recent Ubuntu releases no longer install by default. Run sudo apt install libfuse2, or extract the AppImage with --appimage-extract and run squashfs-root/AppRun to bypass FUSE entirely.