If you've been running PostgreSQL on your server for a while, you've been used to new versions automatically creating a default cluster.
When you install Postgres 16 after say Postgres 15, you'll see that it creates /etc/postgresql/16/main/postgresql.conf
and all the other configuration files alongside /etc/postgresql/15/main/
. Each version gets it's own default main cluster after installation.
But if you're using the official Postgres APT repository on Ubuntu or Debian, you may notice Postgres 17 does not do this. After installing Postgres 17, the /etc/postgresql/17
directory is missing entirely. If you're looking for /etc/postgresql/17/main/postgresql.conf
you won't find it.
Why? The PostgreSQL Debian package's postinstall script has been changed to detect existing clusters and skip creation of a new main cluster if another cluster exists.
Presumably, this is to help make the upgrade process simpler. If you already have Postgres 16 or lower installed, chances are you'll want to upgrade the cluster to run on Postgres 17. With this change, you no longer have to remove or rename the default main cluster for the new Postgres version during the upgrade process.
But if you do want to create a default main cluster for Postgres 17, you will need to run:
$ pg_createcluster -u postgres --no-status 17 main
This is the same command the postgresql-17 package would run during install if no other Postgres clusters exist. You can see the new cluster by running pg_lsclusters
$ sudo pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
16 main 5432 online postgres /var/lib/postgresql/16/main /var/log/postgresql/postgresql-16-main.log
17 main 5433 down postgres /var/lib/postgresql/17/main /var/log/postgresql/postgresql-17-main.log
To start the new Postgres 17 cluster, you can run:
$ sudo service postgresql start
You can then see that both clusters are running:
$ sudo pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
16 main 5432 online postgres /var/lib/postgresql/16/main /var/log/postgresql/postgresql-16-main.log
17 main 5433 online postgres /var/lib/postgresql/17/main /var/log/postgresql/postgresql-17-main.log
If you're curious about upgrading Postgres versions on Ubuntu server, take a look at our guide Upgrading PostgreSQL version on Ubuntu Server