Install Kong and Konga on CentOS7

1. Install Kong

Install environment

# yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel git

Install postgresql 10

# yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# yum install -y postgresql10-server
# yum install -y postgresql10-server
# /usr/pgsql-10/bin/postgresql-10-setup initdb
# systemctl enable postgresql-10
# systemctl start postgresql-10

Change password postgres and add user kong

# passwd postgres
# adduser kong
# passwd kong

Create DB for Kong

# su postgres
psql
create user kong with password 'your_password';
create database kong owner kong;
grant all privileges on database kong to kong;
\q
exit;

Config Postgres

# vim /var/lib/pgsql/10/data/pg_hba.conf

add this

host    all   all  127.0.0.1/32  trust

# vim /var/lib/pgsql/10/data/postgresql.conf
listen_addresses = 'localhost'

# systemctl restart postgresql-10.service

Install Kong

You Can install from this web

Kong Docs | Install - CentOS
Documentation for Kong, the Cloud Connectivity Company for APIs and Microservices.

# cp /etc/kong/kong.conf.default /etc/kong/kong.conf
# vim /etc/kong/kong.conf

admin_listen =0.0.0.0:8001

database = postgres
pg_host = 127.0.0.1
pg_port 5432
pg_user = kong
pg_password = your_password #PASSWORD POSTGRESQL USER KONG
pg_database = kong

Start kong

# kong migrations bootstrap -c/etc/kong/kong.conf
# kong start -c/etc/kong/kong.conf --vv
# curl 127.0.0.1:8001


2. Install Konga

Check firewall allow 1337

Install environment (don't use root for install )

# su kong
$ cd

(Recommend install nodejs ver. 12.16.x)

install nvm

$ curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
$ source ~/.bashrc
$ nvm install 12.16

\

$ npm install npm@latest -g

$ npm install -g gulp bower sails

Download and install Konga

$ git clone https://github.com/pantsel/konga.git
$ cd konga
$ npm i

Add database for konga

$ su postgres
psql
CREATE USER konga WITH PASSWORD'your_password';
CREATE DATABASE konga OWNER konga;
grant all privileges on database konga to konga;
\q
exit;

Test connect database

$ node ./bin/konga.js prepare --adapter postgres --uri
postgresql://konga:your_password@127.0.0.1:5432/konga

Copy the configuration file template as .env

$ cp -r .env_example .env
$ vim .env

HOST=your_ip
PORT=1337
NODE_ENV=production
KONGA_HOOK_TIMEOUT=120000
DB_ADAPTER=postgres
#DB_URI=postgresql://localhost:5432/konga
DB_USER=konga
DB_PASSWORD=your_password
DB_PORT=5432
DB_DATABASE=konga
KONGA_LOG_LEVEL=warn
TOKEN_SECRET=some_secret_token

Start Konga

$ npm run production &

(& mean Background start)

Konga use port 1337

Stop Konga

$ ps -aux | grep node

$ kill -9 30936