Ubuntu

Open Source API Gateway – Kong Install in Ubuntu 20.04

Open Source API Gateway – Kong Install in Ubuntu 20.04

Kong gateway is one of the open source API gateway in the Cloud Native World. As it is an API gateway, it also sits in front of any API services and provides security and control. It is also used to manage the lifecycle of APIs and microservices. It provides services like Rate-limiting, Authentication, API keys, analysis, etc.

In this article, we are going to discuss the installation process of Kong API gateway on Ubuntu 20.04 LTS server.

Installation of Kong API gateway on Ubuntu 20.04

To install the Kong API gateway on Ubuntu 20.04 LTS server, firstly you have to download its respective package with the available version. Run the command as shown below to download the 2.7.0 version as it is the latest one at the time of writing this article.

$ curl -Lo kong.2.7.0.amd64.deb "https://download.konghq.com/gateway-2.x-ubuntu-focal/pool/all/k/kong/kong_2.7.0_amd64.deb"

After successfully downloading the package, use the dpkg command to install the deb file. Check the command as shown below for further details.

$ sudo dpkg -i kong.2.7.0.amd64.deb

As shown on the above screenshot, we have successfully installed the Kong API gateway on the Ubuntu 20.04 LTS server.

Generating a config file for Kong

As Kong runs in a DB-less mode, we will not use a database in this case. For that,a config file for kong is to be generated. Simply, run the command as shown below to generate the config file for kong.

$ kong config init

After executing the above command, it will generate a config file named “kong.yml”.

It is the default kong.yml file generated after execution of the “kong config init” command.

Let’s edit some lines of the this file with the new one as shown below.

$ sudo vim kong.yml

database = off

declarative_config: /home/ubuntu/kong.yml

Running Kong API

As we have created a config file and edited a few lines of it. Now let’s start the Kong API with the command as shown below.

$ sudo kong start -c kong.yml

In the above screenshot, you are able to see that the kong API is started.

To further verify if Kong API is started or not, run the command as shown below.

$ curl -i http://localhost:8001

In the above screenshot, it is clear to see the Kong API is working.

Conclusion

In this article, you have learnt how to install and configure the Kong API gateway on Ubuntu 20.04 LTS server. It is one of the most used API gateway that is easy to install on the Ubuntu server. Thank you!

Similar Posts