{"id":14236,"date":"2022-01-21T12:00:59","date_gmt":"2022-01-21T12:00:59","guid":{"rendered":"https:\/\/linuxways.net\/?p=14236"},"modified":"2022-01-21T12:00:59","modified_gmt":"2022-01-21T12:00:59","slug":"open-source-api-gateway-kong-install-in-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/open-source-api-gateway-kong-install-in-ubuntu-20-04\/","title":{"rendered":"Open Source API Gateway &#8211; Kong Install in Ubuntu 20.04"},"content":{"rendered":"<p>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.<\/p>\n<p>In this article, we are going to discuss the installation process of Kong API gateway on Ubuntu 20.04 LTS server.<\/p>\n<h2>Installation of Kong API gateway on Ubuntu 20.04<\/h2>\n<p>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.<\/p>\n<pre>$ 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\"<\/pre>\n<p>After successfully downloading the package, use the dpkg command to install the deb file. Check the command as shown below for further details.<\/p>\n<pre>$ sudo dpkg -i kong.2.7.0.amd64.deb<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"657\" height=\"129\" class=\"wp-image-14237\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-492.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-492.png 657w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-492-300x59.png 300w\" sizes=\"auto, (max-width: 657px) 100vw, 657px\" \/><\/p>\n<p>As shown on the above screenshot, we have successfully installed the Kong API gateway on the Ubuntu 20.04 LTS server.<\/p>\n<h2>Generating a config file for Kong<\/h2>\n<p>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.<\/p>\n<pre>$ kong config init<\/pre>\n<p>After executing the above command, it will generate a config file named \u201c<strong>kong.yml<\/strong>\u201d.<\/p>\n<p>It is the default <strong>kong.yml<\/strong> file generated after execution of the \u201c<strong>kong config init<\/strong>\u201d command.<\/p>\n<p>Let\u2019s edit some lines of the this file with the new one as shown below.<\/p>\n<pre>$ sudo vim kong.yml<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"529\" height=\"58\" class=\"wp-image-14238\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-493.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-493.png 529w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-493-300x33.png 300w\" sizes=\"auto, (max-width: 529px) 100vw, 529px\" \/><\/p>\n<pre>database = off\r\n\r\ndeclarative_config: \/home\/ubuntu\/kong.yml<\/pre>\n<h2>Running Kong API<\/h2>\n<p>As we have created a config file and edited a few lines of it. Now let\u2019s start the Kong API with the command as shown below.<\/p>\n<pre>$ sudo kong start -c kong.yml<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"904\" height=\"60\" class=\"wp-image-14239\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-494.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-494.png 904w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-494-300x20.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-494-768x51.png 768w\" sizes=\"auto, (max-width: 904px) 100vw, 904px\" \/><\/p>\n<p>In the above screenshot, you are able to see that the kong API is started.<\/p>\n<p>To further verify if Kong API is started or not, run the command as shown below.<\/p>\n<pre>$ curl -i <a href=\"http:\/\/localhost:8001\">http:\/\/localhost:8001<\/a><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"503\" height=\"172\" class=\"wp-image-14240\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-495.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-495.png 503w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-495-300x103.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-495-501x172.png 501w\" sizes=\"auto, (max-width: 503px) 100vw, 503px\" \/><\/p>\n<p>In the above screenshot, it is clear to see the Kong API is working.<\/p>\n<h2>Conclusion<\/h2>\n<p>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!<\/p>","protected":false},"excerpt":{"rendered":"<p>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&hellip;<\/p>","protected":false},"author":1,"featured_media":14261,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[442,100],"class_list":["post-14236","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-kong-api-gateway","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/14236","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=14236"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/14236\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/14261"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=14236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=14236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=14236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}