一、下载安装kong和postgresql
wget https://dl.bintray.com/mashape/kong-rpm-el6-0.10.x/0.10.3/kong-0.10.3.el6.noarch.rpm
rpm -ivh kong-0.10.3.el6.noarch.rpm
yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm -y
yum install postgresql96 -y
yum install postgresql96-server -y
二、初始化启动postgresql
service postgresql-9.6 initdb
chkconfig postgresql-9.6 on
service postgresql-9.6 start
三、设置postgresql密码,建立kong 库
1、su postgres
2、psql
alter user postgres with password ‘1234560.‘;
CREATE USER kong; CREATE DATABASE kong OWNER kong;
\q
四、修改kong链接数据得级别为password
1、vi /var/lib/pgsql/9.6/data/pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all password
# IPv4 local connections:
host all all 127.0.0.1/32 password
host all all 0.0.0.0/0 password
# IPv6 local connections:
host all all ::1/128 ident
2、service postgresql-9.6 restart
五、设置kong 连接postgresql 密码
1、cd /etc/kong/
2、cp kong.conf.default kong.conf
3、vim kong.conf
pg_user = kong # The username to authenticate if required.
pg_password = kong # The password to authenticate if required.
pg_database = kong
4、vim /etc/profile
export KONG_SERF_PATH="/usr/local/bin/serf"
六、启动kong
kong start