一.安裝Kong
下載之後,我們直接啓動命令直接解壓
二. 安裝數據庫
kong使用前要首先配置數據庫,目前kong支持"cassandra", "postgres"。這裏安裝使用postgres。
1st. 添加PostgreSQL
yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-3.noarch.rpm
2st. 安裝postgresql
yum install postgresql95
3rd. 安裝postgresql server
yum install postgresql95-server
4ur. 查看安裝 rpm -qa|grep postgres
5.初始化數據庫
初始化之前我們應該找到你安裝的應用的位置。
CentOS yum安裝路徑查詢方法:https://blog.csdn.net/CGD_ProgramLife/article/details/80459860我的安裝目錄在usr/下,我就之間上乾貨了,你們自己找一找你們的。
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
# IPv4 local connections:
host all all 127.0.0.1/32 @authmethodhost@
host all all 0.0.0.0/0 md5
7. 啓動服務並設置爲開機啓動
systemctl enable postgresql-9.5
systemctl start postgresql-9.5
8.訪問PostgreSQL
輸入su - postgres
輸入命令psql 將看到PostgrSQL的版本信息
① 創建數據庫用戶
CREATE USER dbuser(你自己創建使用名稱) WITH PASSWORD 'password' ;
②創建數據庫與用戶關聯
CREATE DATABASE kong OWNER dbuser;
③ 設置權限
9.kong start
你需要告訴你的Linux允許進程綁定到非本地地址。只需添加以下行的/etc/sysctl.conf 文件:
#允許進程綁定到非本地地址 #(必要阿帕奇/ nginx的亞馬遜EC2) net.ipv4.ip_nonlocal_bind = 1
然後重新加載sysctl.conf的: sysctl -p /etc/sysctl.conf 中
至此,kong的安裝結束。並且成功的運行。