docker run --restart=always --name=pg \
-e POSTGRES_PASSWORD=<MySecretPassword> \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v /package/pgdb:/var/lib/postgresql/data \
-p 5432:5432 -d postgres:12.8
https://hub.docker.com/_/postgres
https://www.postgresql.org/download/linux/redhat/
dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
dnf -qy module disable postgresql
dnf install -y postgresql12-server
/usr/pgsql-12/bin/postgresql-12-setup initdb
systemctl enable postgresql-12
systemctl start postgresql-12
su postgres
psql -U postgres
alter user postgres with encrypted password 'Abc123....';
vi /var/lib/pgsql/12/data/postgresql.conf
vi /var/lib/pgsql/12/data/pg_hba.conf
host all all 127.0.0.1/32 trust
host all all 0.0.0.0/0 md5
systemctl restart postgresql-12
https://www.cnblogs.com/zhi-leaf/p/11432054.html
dnf module list postgresql
dnf module enable postgresql:15
dnf install postgresql-server
postgresql-setup --initdb
systemctl start postgresql
systemctl enable postgresql
sudo -i -u postgres
psql
ALTER USER postgres PASSWORD 'Abc123.';
create user tmpuser with password 'Abc123.';
CREATE TABLESPACE ts_tmp OWNER tmpuser LOCATION '/package/pgsql'
SELECT spcname, pg_size_pretty(pg_tablespace_size(spcname)) tsSize, pg_tablespace_location(oid) tsLocation FROM pg_tablespace;
DROP TABLESPACE IF EXISTS ts_tmp;
DROP TABLE IF EXISTS tablename;
CREATE DATABASE tmpdb WITH OWNER = tmpuser ENCODING = utF8 TABLESPACE = ts_tmp;
GRANT ALL PRIVILEGES ON DATABASE tmpdb TO tmpuser;