slackbuilds/system/postgresql17/README.SBo

61 lines
2.5 KiB
Plaintext

Before you can run postgresql you'll need to create the
database files in /var/lib/pgsql. The following should do
the trick.
# su postgres -c "initdb -D /var/lib/pgsql/17/data --locale=en_US.UTF-8 -A md5 -W"
Additionally, a logrotation script and init script are included.
For production level log file handling please read
https://www.postgresql.org/docs/17/logfile-maintenance.html
In order to start postgresql at boot and stop it properly at shutdown,
make sure rc.postgresql17 is executable and add the following lines to
the following files:
/etc/rc.d/rc.local
==================
# Startup postgresql
if [ -x /etc/rc.d/rc.postgresql17 ]; then
/etc/rc.d/rc.postgresql17 start
fi
/etc/rc.d/rc.local_shutdown
===========================
# Stop postgres
if [ -x /etc/rc.d/rc.postgresql17 ]; then
/etc/rc.d/rc.postgresql17 stop
fi
Additionally, rc.postgresql17 script has additional modes for stop/restart:
force-stop|force-restart (i.e. pg_ctl 'fast' mode)
unclean-stop|unclean-restart (i.e. pg_ctl 'immediate' mode)
See https://www.postgresql.org/docs/17/app-pg-ctl.html
From PostgreSQL 9.3 we support in place database upgrades using pg_upgrade:
https://www.postgresql.org/docs/17/pgupgrade.html
A few hints for PostgreSQL 16.x -> 17.x upgrade:
- Don't remove old PostgreSQL 16.x package (yet)
- Install PostgreSQL 17.x, note that binaries are in
'/usr/lib64/postgresql17/17/bin'
- Create database file for postgresql 17
# su postgres -c "initdb -D /var/lib/pgsql/17/data --locale=en_US.UTF-8 -A md5 -W"
- Adjust the pg_hba.conf in postgresql 17 to allow postgres user to connect
- Run pg_upgrade (as postgres user)
$ pg_upgrade --old-datadir /var/lib/pgsql/16/data/ --new-datadir /var/lib/pgsql/17/data/ --old-bindir /usr/lib64/postgresql16/16/bin/ --new-bindir /usr/lib64/postgresql17/17/bin/ -U postgres
- Start postgresql 17 service
- Optionally, vacuum all database
/usr/lib{64}/postgresql17/17/bin/vacuumdb -U postgres --all --analyze-in-stages
To remove old's cluster data files, run:
./delete_old_cluster.sh
- Remove old package when transition is over, or read comments in
rc.postgresql if you want to run multiple PostgreSQL versions in parallel
This script builds postgresql with some useful extension modules from
the contrib directory, see PG_EXTENSIONS in SlackBuild file.
To build PostgreSQL with all extensions, use the following command:
# PG_EXTENSIONS=ALL ./postgresql.SlackBuild
Please note that in order to actually use extension, you must execute
'CREATE EXTENSION [ IF NOT EXISTS ] extension_name' for each extension.