yum install yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
yum install postgresql10 -y
yum install postgresql10-server -y
/usr/pgsql-10/bin/postgresql-10-setup initdb
echo "listen_addresses='*'" >> /var/lib/pgsql/10/data/postgresql.conf
echo "host all all 0.0.0.0/0 md5" >> /var/lib/pgsql/10/data/pg_hba.conf
systemctl enable postgresql-10
systemctl start postgresql-10
su - postgres
psql
\password postgres
mkdir -p /pgsql/data
chown postgres:postgres /pgsql/data
chmod 700 /pgsql/data
mkdir -p /pgsql/index
chown postgres:postgres /pgsql/index
chmod 700 /pgsql/index
mkdir -p /pgsql/data/tbs_demo
create tablespace tbs_demo owner postgres location '/pgsql/data/tbs_demo';
CREATE DATABASE "demo"
WITH
OWNER = "postgres"
TEMPLATE = "template0"
ENCODING = 'UTF8'
LC_COLLATE = 'zh_CN.UTF-8'
LC_CTYPE = 'zh_CN.UTF-8'
TABLESPACE = "tbs_demo"
;