During our PostgreSQL DBA Essentials workshops we install PostgreSQL from source code. We do that, to provide the participants all the options they have. There is nothing wrong with using a packaged distribution of PostgreSQL, don’t get me wrong, but knowing how it is working in the background is always a good idea. One question that comes up quite frequently is, how you can compile/install only the client. but not the server itself. Not a big deal, lets have a look:

We usually set three environment variables before we configure the source tree:


The meaning of those variables is:

  • PGHOME: This is the target directory for the installation
  • SEGSIZE: This is the segment size, which defines how large a PostgreSQL data file can grow on disk (2GB in this example)
  • BLOCKSIZE: The size of PostgreSQL block, 8k

Once we have that, we configure the source tree like this (this is for PostgreSQL 14):

./configure --prefix=${PGHOME} 
            --with-llvm LLVM_CONFIG='/usr/bin/llvm-config' 

To install the client only, all you have to do is this:

[email protected]:/home/postgres/postgresql/ [pgdev] make -C src/bin install
[email protected]:/home/postgres/postgresql/ [pgdev] make -C src/include install
[email protected]:/home/postgres/postgresql/ [pgdev] make -C src/interfaces install

This will give you all the client utilities but not the server itself:

[email protected]:/home/postgres/postgresql/ [pg15] ls /u01/app/postgres/product/14/db_2/bin/
clusterdb   dropdb    initdb             pg_basebackup  pg_config       pg_dump     pg_receivewal   pg_restore     pg_test_timing   pg_waldump  vacuumdb
createdb    dropuser  pg_amcheck         pgbench        pg_controldata  pg_dumpall  pg_recvlogical  pg_rewind      pg_upgrade       psql
createuser  ecpg      pg_archivecleanup  pg_checksums   pg_ctl          pg_isready  pg_resetwal     pg_test_fsync  pg_verifybackup  reindexdb

That’s it, pretty easy.

Thumbnail [60x60]
Daniel Westermann