Install Kong and Konga On CentOS7

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

9/7/2021 Install Kong and Konga on CentOS7

Home Tutorial Author    

Article

Install Kong and


Konga on CentOS7
Chanitapon
20 Aug 2021 • 4 min read

1. Install Kong

Install environment

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


openssl-devel git

https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 1/16
9/7/2021 Install Kong and Konga on CentOS7

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

https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 2/16
9/7/2021 Install Kong and Konga on CentOS7

https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 3/16
9/7/2021 Install Kong and Konga on CentOS7

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;
https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 4/16
9/7/2021 Install Kong and Konga on CentOS7

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'

https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 5/16
9/7/2021 Install Kong and Konga on CentOS7

# 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.

Kong Docs • KongHQ

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

# vim /etc/kong/kong.conf

1 admin_listen =0.0.0.0:8001

https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 6/16
9/7/2021 Install Kong and Konga on CentOS7
2
3 database = postgres

4 pg_host = 127.0.0.1

5 pg_port 5432

6 pg_user = kong

7 pg_password = your_password #PASSWORD POSTGRESQL USER KONG

8 pg_database = kong

Start kong

# kong migrations bootstrap -c/etc/kong/kong.conf

https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 7/16
9/7/2021 g g p Install Kong and Konga
g on CentOS7
g
# kong start -c/etc/kong/kong.conf --vv

# curl 127.0.0.1:8001

https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 8/16
9/7/2021 Install Kong and Konga on CentOS7

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

https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 9/16
9/7/2021 Install Kong and Konga on CentOS7

$ 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

https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 10/16
9/7/2021 Install Kong and Konga on CentOS7

Add database for konga

$ su postgres

psql
https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 11/16
9/7/2021 Install Kong and Konga on CentOS7
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

1 HOST=your_ip

2 PORT=1337
https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 12/16
9/7/2021 Install Kong and Konga on CentOS7
2 PORT=1337

3 NODE_ENV=production

4 KONGA_HOOK_TIMEOUT=120000

5 DB_ADAPTER=postgres

6 #DB_URI=postgresql://localhost:5432/konga

7 DB_USER=konga

8 DB_PASSWORD=your_password

9 DB_PORT=5432

10 DB_DATABASE=konga

11 KONGA_LOG_LEVEL=warn

12 TOKEN_SECRET=some_secret_token

Start Konga

$ npm run production &

(& mean Background start)

Konga use port 1337

https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 13/16
9/7/2021 Install Kong and Konga on CentOS7

https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 14/16
9/7/2021 Install Kong and Konga on CentOS7

https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 15/16
9/7/2021 Install Kong and Konga on CentOS7

Stop Konga

$ ps -aux | grep node

$ kill -9 30936

Share    

Add Rule block IP ต่าง…


1) Install ipset apt install ipset 2)
สร้าง directory เก็บ… 
29 Apr 2021

https://blog.unixdev.co.th/install-kong-and-konga-on-centos7/ 16/16

You might also like