HomeTyk Open Source API Gateway v2.xInstallation Options & SetupInstall Tyk Community Edition on Ubuntu

Install Tyk Community Edition on Ubuntu

Tyk has it’s own APT repositories hosted by the kind folks at packagecloud.io, which makes it easy, safe and secure to install a trusted distribution of the Tyk Gateway stack.

This tutorial will run on an Amazon AWS Ubuntu Server 14.04 LTS instance. We will install only Tyk Gateway with all dependencies stored locally.

We’re installing on a t2.micro because this is a demo, you’ll need more RAM and more cores for better performance.


  • Ensure port 8080 is open: this is used in this guide for Gateway traffic (API traffic to be proxied)

Installation steps:

1. Set up our APT repositories:

First, add our GPGP key which signs our binaries:

curl https://packagecloud.io/gpg.key | sudo apt-key add -

Run update:

sudo apt-get update

Since our repositories are installed via HTTPS, you will need to make sure APT supports this:

sudo apt-get install -y apt-transport-https

Now lets add the required repos and update again (notice the -a flag in the second Tyk commands – this is important!):

echo "deb https://packagecloud.io/tyk/tyk-gateway/ubuntu/ trusty main" | sudo tee /etc/apt/sources.list.d/tyk_tyk-gateway.list

echo "deb-src https://packagecloud.io/tyk/tyk-gateway/ubuntu/ trusty main" | sudo tee -a /etc/apt/sources.list.d/tyk_tyk-gateway.list

sudo apt-get update

What we’ve done here is:

  • Added the Tyk Gateway repository
  • Updated our package list

2. Install the Tyk stack:

We’re now ready to install Tyk Gateway, along with Redis. To install everything run:

sudo apt-get install -y redis-server tyk-gateway

What we’ve done here is instructed apt-get to install Redis and the Tyk Gateway without prompting, wait for the downloads to complete.

When Tyk is finished installing, it will have installed some init scripts, but it will not be running yet. The next step will be to setup each application – thankfully this can be done with a very simple command.

3. Configure Tyk Gateway

You can set up the core settings for Tyk Gateway with a single setup script, however for more involved deployments, you will want to provide your own configuration file, to get things running lets run:

sudo /opt/tyk-gateway/install/setup.sh --listenport=8080 --redishost=localhost --redisport=6379 --domain=""

What we’ve done here is told the setup script that:

  • --listenport=8080 Tyk should listen on port 8080 for API traffic
  • --redishost=localhost Use redis on the hostname: localhost
  • --redisport=6379 Use the default redis port
  • --domain="" Do not set a domain for the gateway, see the note on domains below for more about this

Pro Tip: Domains with Tyk Gateway

Tyk Gateway has full built in domain support, you can:

  • Set Tyk to listen only on a specific domain for all API traffic
  • Set an API to listen on a specific domain (e.g. api1.com, api2.com)
  • Split APIs over a domain using a path (e.g. api.com/api1, api.com/api2, moreapis.com/api1, moreapis.com/api2 etc.)
  • If you have set a hostname for the gateway, then all non-domain-bound APIs will be on this hostname + the listen_path

In this example, we don’t want Tyk to listen on a single domain, and we can always set up custom domains at the API level in the dashboard. It is recommended to leave the Tyk gateway domain unbounded for flexibility and ease of deployment.

5. Start Tyk:

    sudo service tyk-gateway start

Next Steps

Was this article helpful to you? Yes No