PostgreSQL安装
- 使用yum安装PostgreSQL
# Install the repository RPM:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# Install PostgreSQL:
sudo yum install -y postgresql11-server
# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-11/bin/postgresql-11-setup initdb
sudo systemctl enable postgresql-11
sudo systemctl start postgresql-11
- 切换成postgres用户,验证安装
# 切换用户
sudo -i -u postgres
# 进入PostgreSQL
psql
# 创建用户和数据库,为安装kong做准备(不装kong的同学请忽略)
CREATE USER kong; CREATE DATABASE kong OWNER kong;
- 设置监听IP
vim /var/lib/pgsql/11/data/postgresql.conf
- 修改配置
listen_addresses = '0.0.0.0'
- 设置信任IP
vim /var/lib/pgsql/11/data/pg_hba.conf
- 修改配置
host all all 127.0.0.1/32 trust
host all all 172.30.24.0/8 trust
- 退出
\q