PostgreSQL
CentOS 7
PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.
Installation
source : https://tecadmin.net/install-postgresql-11-on-centos/
sudo yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install postgresql${version}-server
/usr/pgsql-${version}/bin/postgresql-${version}-setup initdb
systemctl enable postgresql-${version}.service systemctl start postgresql-${version}.service
postgres=# \password postgres
Upgrade
https://www.postgresql.org/docs/11/upgrading.html
Minor version
- Stopper le service postgreSQL
$ systemctl stop postgresql-11.service
- Faire un dump global
$ pg_dumpall > db.out
- Upgrader la version de postgreSQL
yum install postgresql11-${MINOR_VERSION}
yum install postgresql11-server-11.11-1PGDG.rhel7
Show available minor version
yum list postgresql11 --showduplicates
- Relancer le service
$ systemctl start postgresql-11.service
Effective MEP
service postgresql-11 stop
cp -fra /mnt/data1/pgsql /mnt/data1/pgsql-old-20220510
yum remove postgresql11
yum install postgresql11-11.11-1PGDG.rhel7 postgresql11-server-11.11-1PGDG.rhel7 postgresql11-contrib-11.11-1PGDG.rhel7
mv /var/lib/pgsql /var/lib/pgsql.old-20220510
ln -sf /mnt/data1/pgsql /var/lib/pgsql
service postgresql-11 start