* 初始化数据库
# /usr/bin/postgresql-setup initdb
* 启动postgresql服务
# systemctl start postgresql
* 设置开机自启动
# systemctl enable postgresql
* 登录postgresql
# su - postgres
$ psql -U postgres
* 修改postgres用户密码
ALTER USER postgres with encrypted password 'postgres';
4)远程配置
* 开启远程访问
# vi /var/lib/pgsql/data/postgresql.conf
listen_addresses = '*' # what IP address(es) to listen on;
* 信任远程连接
# vi /var/lib/pgsql/data/pg_hba.conf
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 192.168.9.139/32 trust
* 重启postgresql服务
# systemctl restart postgresql