安裝以及啓動sql
yum install readline-devel
tar xf postgresql-11.1.tar.gz
cd postgresql-11.1
./configure --prefix=/data/postgresql
make && make install
# useradd postgres # groupadd postgres
mkdir /data/postgresql/data
chown postgres.postgres /data/postgresql/data
su - postgres
#數據庫初始化
/data/postgresql/bin/initdb -D /data/postgresql/data
#配置容許ip訪問
vim /data/postgresql/data/pg_hba.conf
# "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust host all all 192.168.137.3/24 trust # IPv6 local connections: host all all ::1/128 trust # Allow replication connections from localhost, by a user with the # replication privilege. local replication all trust host replication all 127.0.0.1/32 trust host replication all ::1/128 trust host all all * md5
#修改監聽地址和鏈接端口數據庫
vim /data/postgresql/data/postgresql.conf vim
listen_addresses = '*' port = 5432
#啓動(以postgres用戶啓動)dom
/data/postgresql/bin/pg_ctl -D /data/postgresql/data -l /data/postgresql/data/logfile start#從新加載配置/data/postgresql/bin/pg_ctl -D /data/postgresql/data reload