官网下载页面:http://www.postgres.cn/v2/download
1, wget https://ftp.postgresql.org/pub/source/v12.2/postgresql-12.2.tar.bz2
2, tar xjvf postgresql*.bz2 #解压至一个目录
cd potgresql-12.2
3, ./configure --prefix=/opt/pgsql #拟安装至/opt/pgsql
4, make world
5, make install-world
6, adduser postgres #增加新用户,系统提示要给定新用户密码
7, mkdir /opt/pgsql/data #创建数据库目录
8, chown -R postgres:postgres /opt/pgsql/data
9, su - postgres #使用postgres帐号操作
10, /opt/pgsql/bin/initdb -D /opt/pgsql/data #初始化数据库
11, /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start #启动数据库
12, /opt/pgsql/bin/psql # (进入数据库内部)
13, create user kong with password 'kong';
14, CREATE DATABASE kong OWNER kong;
配置kong
1, cp /etc/kong/kong.conf.default /etc/kong/kong.conf
2, vim /etc/kong/kong.conf
添加如下配置
pg_host = 127.0.0.1 # The PostgreSQL host to connect to.
pg_port = 5432 # The port to connect to.
pg_user = kong # The username to authenticate if required.
pg_password = kong # The password to authenticate if required.
pg_database = kong
3, kong migrations bootstrap -c /etc/kong/kong.conf
4, kong start -c /etc/kong/kong.conf --vv