Setting up Kong (1.4.0) API-Gateway on Ubuntu 18.04

Sudaraka Jayathilaka
2 min readNov 24, 2019

--

First of all, we need to install the dependencies required for kong. Please execute following commands to install dependencies

sudo apt-get update 
sudo apt-get install -y openssl libpcre3 procps perl unzip

Now its time to download kong binary file. For downloading binary and installing the package please execute the following command

wget https://bintray.com/kong/kong-deb/download_file?file_path=kong-1.4.0.bionic.amd64.deb -O kong-1.4.0.bionic.amd64.deb
sudo dpkg -i kong-1.4.0.*.deb

Now we can test whether the Kong installation was successful by running following command

kong roar

If the installation was successful, it should print the following output

➜  ~ kong roar
Kong, Monolith destroyer.
/\ ____
<> ( oo )
<>_| ^^ |_
<> @ \
/~~\ . . _ |
/~~~~\ | |
/~~~~~~\/ _| |
|[][][]/ / [m]
|[][][[m]
|[][][]|
|[][][]|
|[][][]|
|[][][]|
|[][][]|
|[][][]|
|[][][]|
|[][][]|
|[|--|]|
|[| |]|
========
==========
|[[ ]]|
==========

Now it’s time to create required directories (PS: I will be running kong as the konguser . This user is already on my system. )

sudo mkdir -p /usr/local/kong 
sudo mkdir -p /etc/kong #This folder is for keeping config

The user that runs kong should have the necessary access to these folders.

sudo chown -R konguser:konguser /usr/local/kong 
sudo chown -R konguser:konguser /etc/kong

You can download a sample kong config from here ( for version 1.4.0 )

cd /etc/kong
wget https://raw.githubusercontent.com/Kong/kong/1.4.0/kong.conf.default -O kong.conf

You can edit the configurations accordingly and start kong with the following command

kong start -c /etc/kong/kong.conf

But each time you restart remember to use the config path

kong restart -c /etc/kong/kong.conf

You can check the logs for kong with the following command

tail -f /usr/local/kong/logs/access.log

You can check whether kong was started successfully by executing the following commands,

curl localhost:8001/status

Please let me know if you have any issue with the following steps.

--

--