---
title: "Configuring PostgreSQL"
source: https://dev.pageseeder.com/guide/installation/configuring_postgresql.html
description: "This guide provides step-by-step instructions for configuring PostgreSQL with PageSeeder, including installation, JDBC driver setup, performance tuning, and database backup/restore procedures for both Linux and Windows systems."
last_updated: 2026-08-11T16:10:50+10:00
tokens: ~1623
---

# Configuring PostgreSQL

> **Warning:** PostgreSQL support is still experimental and it is not currently recommended for production systems.

## Install PostgreSQL

PageSeeder v5.99 or higher supports PostgreSQL v14 to v17 which can be downloaded from [https://www.postgresql.org](https://www.postgresql.org/) for Windows or installed on Linux using commands like:

```shell
# yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# dnf -qy module disable postgresql
# dnf -y install postgresql17-server
# /usr/pgsql-17/bin/postgresql-17-setup initdb
# systemctl enable postgresql-17
# systemctl start postgresql-17
```

> **Note:** On Windows if you get the error “Unable to write inside TEMP environment variable path” try running `regedit`, navigate to `HKEY_CLASSES_ROOT\.vbs` and change the `(Default)` key back to the string `VBSFile`.

### Set the postgres password

On Linux, so PageSeeder can set up its own user and database, you need to set a password for the login name `postgres` as follows. Later, in the PageSeeder setup screen, you must enter these details under **Database administrator:** login name and password.

```shell

$ sudo -u postgres psql
# \password
Enter new password:
Enter it again:
# \q
```

### Changing where data is stored

On Linux PostgreSQL usually stores data under `/var/lib/pgsql/12/data`, but if you want to use mounted storage for pageseeder (for example storage mapped to the `/opt` folder), you can configure PostgreSQL to store data there as well. To do this, follow these steps:

Stop PostgreSQL by entering:

```shell
# systemctl stop postgresql-17
```

Move the existing PostgreSQL data to the new location:

```shell
# mv /var/lib/pgsql/17/data> /opt/pgsql/data
```

Edit the service by entering `systemctl edit postgresql-17`, pressing Insert , entering the following, pressing Esc and then `:x` to save (this creates a file `/etc/systemd/system/postgresql-17.service.d/override.conf` ).

```ini
[Service]
Environment=PGDATA=/opt/pgsql/data
```

Reload the service by entering:

```shell
# systemctl daemon-reload
```

Start PostgreSQL by entering:

```shell
# systemctl start postgresql-17
```

> **Note:** If PostgreSQL doesn’t start after changing the data location, SELinux might need to be configured to allow access to the new location by entering the following (see [Troubleshooting](configuring_a_proxy.md) for more info). ```shell # semanage fcontext -a -t postgresql_db_t '/opt/pgsql(.*/)?' # restorecon -Rv /opt/pgsql ```

## Install the JDBC driver

The PageSeeder app requires a JDBC driver to communicate with PostgreSQL. Download the appropriate version of the PostgreSQL JDBC driver and save it on your server.

- On Windows it can be downloaded from: [https://jdbc.postgresql.org](https://jdbc.postgresql.org/) .
- On Linux, use the following commands *(URL and version might have changed)*:

```shell
# wget https://jdbc.postgresql.org/download/postgresql-42.7.5.jar
```

*The PageSeeder installer asks for the location of the JDBC driver JAR file to be identified.*

## Tune PostgreSQL

On Linux, make the following configuration changes by editing the file `postgresql.conf` in the `data` folder (see previous section *Changing where data is stored*).

> **Note:** The example below is based on a server with 8GB of memory on which PageSeeder is installed with 3GB heap leaving 4.4GB free (PageSeeder/java can use 20% more than configured `-Xmx` heap size). Set `shared_buffers` to 1/4 of free memory, in this case `1GB` and `effective_cache_size` to 3/4 of free memory, in this case `3GB` (rounding down). If using magnetic drive storage, set `effective_io_concurrency` to the number of separate drives in the RAID stripe. For SSDs and other memory-based storage, the best value might be in the hundreds.

In the `postgresql.conf` file, change `max_connections = 100` to `max_connections = 150` or more than `MaxConnections` in the PageSeeder [database.properties](../configuration/properties/database_properties.md).

Add the following entries at the bottom of the file `postgresql.conf` file, using you own values for  `shared_buffers` , `effective_cache_size` and `effective_io_concurrency` as described in the previous note.

```properties
shared_buffers = 1GB
effective_cache_size = 3GB
join_collapse_limit = 12
work_mem = 16MB
maintenance_work_mem = 256MB
checkpoint_completion_target = 0.9
wal_buffers = 16MB
effective_io_concurrency = 2
min_wal_size = 2GB
max_wal_size = 8GB
max_worker_processes = 4
max_parallel_workers_per_gather = 2
max_parallel_workers = 4
max_parallel_maintenance_workers = 2
```

After saving the file, restart PostgreSQL by entering:

```shell
# systemctl restart postgresql-16
```

## Backup and restore

To backup the PageSeeder database on Linux, use a command like this:

```shell
# sudo -u postgres pg_dump -Fc pageseeder > ps.backup
```

### Restore with overwrite

To overwrite an existing database, first drop it, then recreate it using commands like this:

```shell
# sudo -u postgres psql
drop database pageseeder;
create database pageseeder encoding 'UTF8' lc_collate = 'en_US.UTF-8' lc_ctype = 'en_US.UTF-8' template template0;
grant connect on database pageseeder to pageseeder;
\q
```

To restore the PageSeeder database, use commands like this:

```shell
# sudo -u postgres pg_restore -d pageseeder ps.backup
# sudo -u postgres psql
\c pageseeder;
analyze verbose;
\q
```

### Restore with create

If no database or user exists, create them using commands like this:

```shell
# sudo -u postgres psql
create database pageseeder encoding 'UTF8' lc_collate = 'en_US.UTF-8' lc_ctype = 'en_US.UTF-8' template template0;
create user pageseeder encrypted password '<password>';
grant connect on database pageseeder to pageseeder;
grant create on schema public to pageseeder;
\q
```

To restore the PageSeeder database, use commands like this:

```shell
# sudo -u postgres pg_restore -d pageseeder ps.backup
# sudo -u postgres psql
\c pageseeder;
analyze verbose;
\q
```

> **Note:** The following error when restoring can be ignored: ```text pg_restore: error: could not execute query: ERROR:  schema "public" already exists ```

> **Note:** On Windows, use the **pgAdmin** app for backup/restore (but connect as user **pageseeder**) and the **SQL Shell (psql)** app for running SQL. You might need to use an `en_US` instead of `en_US.UTF-8` for `lc_collate` and `lc_ctype` when creating the database manually.

