https://www.postgresql.org/download/
选择相应的版本
安装完成后,稍微配置下,否则无法远程访问:
cd /var/lib/pgsql/11/data
vi postgresql.conf
增加
listen_addresses = '*'
port = 9310
端口可以使用默认端口不做修改
vi pg_hba.conf
增加
host all all 0.0.0.0/0 md5
新建用户
su - postgres
psql -p 9310
postgres=# CREATE USER dbuser WITH PASSWORD '*****';
postgres=# CREATE DATABASE exampledb OWNER dbuser;
postgres=# GRANT ALL PRIVILEGES ON DATABASE exampledb TO dbuser;
补充下安装控件
yum install postgresql11-contrib
授权:
postgres=# alter user dbuser with SUPERUSER;