Skip to content

Instantly share code, notes, and snippets.

@jeffersfp
Forked from anhldbk/install.sh
Last active January 24, 2018 16:26
Show Gist options
  • Save jeffersfp/7fb4a2c85778b6afdf3dd30e49f22d64 to your computer and use it in GitHub Desktop.
Save jeffersfp/7fb4a2c85778b6afdf3dd30e49f22d64 to your computer and use it in GitHub Desktop.
Install Kong API Gateway on Ubuntu
sudo apt-get install netcat openssl libpcre3 dnsmasq procps perl
# for ubuntu 16.04 (xenial)
sudo apt-get -y install postgresql postgresql-contrib phppgadmin
sudo -i -u postgres
psql
CREATE USER kong; CREATE DATABASE kong OWNER kong;
ALTER USER kong WITH password 'kong';
# for ubuntu 16.04
https://github.com/Mashape/kong/releases/download/0.9.7/kong-0.9.7.xenial_all.deb
sudo dpkg -i kong-0.9.7.xenial_all.deb
sudo bash -c "echo -e 'pg_user = kong\npg_password = kong\npg_database = kong' > /etc/kong.conf"
kong start -vv
# autostart with upstart
sudo apt-get install upstart upstart-sysv
sudo update-initramfs -u
# remember the location of this script
bash -c "echo -e 'kong start -vv' > start.sh"
chmod +x start.sh
mkdir ~/.config
# Create /lib/systemd/system/kong.service with following content
```sh
[Unit]
Description= kong service
After=syslog.target network.target
[Service]
User=root
Group=root
Type=forking
ExecStart=/usr/local/bin/kong start
ExecReload=/usr/local/bin/kong reload
ExecStop=/usr/local/bin/kong stop
[Install]
WantedBy=multi-user.target
```
```
sudo systemctl daemon-reload
sudo systemctl start kong
sudo systemctl status kong
sudo systemctl enable kong
```
# install kong dashboard
sudo npm install -g kong-dashboard
# Start Kong Dashboard
kong-dashboard start
# To start Kong Dashboard on a custom port
kong-dashboard start -p [port]
# To start Kong Dashboard with basic auth
kong-dashboard start -a user=password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment