Skip to content

Instantly share code, notes, and snippets.

@montanaflynn
Last active October 24, 2018 14:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save montanaflynn/9d246ec589758465ad23 to your computer and use it in GitHub Desktop.
Save montanaflynn/9d246ec589758465ad23 to your computer and use it in GitHub Desktop.
Quickly install Kong on Ubuntu 14.04

Install Java, Cassandra & Kong on Ubuntu 14.04

sudo apt-get install -y wget
wget -O kong-install.sh http://git.io/vmMjv
cat kong-install.sh
chmod +x kong-install.sh
sudo ./kong-install.sh
source ~/.bash_profile
sudo cassandra
sudo kong start
# Get things ready
apt-get update
apt-get install -y software-properties-common wget curl
# Install Java
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
add-apt-repository -y ppa:webupd8team/java
apt-get update
apt-get install -y oracle-java8-installer
# Install Cassandra
CASSANDRA_VERSION='2.1.8'
CASSANDRA_PATH="cassandra/${CASSANDRA_VERSION}/apache-cassandra-${CASSANDRA_VERSION}-bin.tar.gz"
CASSANDRA_DOWNLOAD='http://www.apache.org/dyn/closer.cgi?path=/${CASSANDRA_PATH}&as_json=1'
CASSANDRA_MIRROR=`curl -s ${CASSANDRA_DOWNLOAD} | grep -oP "(?<=\"preferred\": \")[^\"]+"`
wget $CASSANDRA_MIRROR$CASSANDRA_PATH
tar -zxf apache-cassandra-${CASSANDRA_VERSION}-bin.tar.gz
mv apache-cassandra-${CASSANDRA_VERSION} /usr/local/cassandra
mkdir /var/lib/cassandra && mkdir /var/log/cassandra
echo 'CASSANDRA_HOME=/usr/local/cassandra' >> ~/.bash_profile
echo 'PATH=$PATH:$CASSANDRA_HOME/bin' >> ~/.bash_profile
# Install Kong
KONG_VERSION='0.4.0'
wget https://github.com/Mashape/kong/releases/download/${KONG_VERSION}/kong-${KONG_VERSION}.trusty_all.deb
apt-get update
dpkg -i kong-${KONG_VERSION}.*.deb
apt-get install -fy
@amarpandey
Copy link

hi,
I am having some issue while running kong. I have installed kong on root. While running kong, i get Cassandra Error: connection refused.

Can you help me out for this. I am using ubuntu 14.04 and previously it was running fine.

@montanaflynn
Copy link
Author

Hi @amarpandey, sorry it took awhile for me to get back to you as I didn't notice the comment until today.

I'd assume that Cassandra is not running locally anymore. Can you try running this line again and waiting for Cassandra to start up and then starting Kong again?

./apache-cassandra-2.1.5/bin/cassandra

The guide doesn't make use of any tools to keep Cassandra running like upstart or init or systemd so you'll have to kill and start the process manually.

@marktopper
Copy link

@ararpandey, I had the same issue.
You can see my issue on Mashape/kong#395.
I ended up reinstalling it using this method.

@montanaflynn
Copy link
Author

I found the problem, the Cassandra download mirror was no longer online. I've added a hack to get the preferred mirror at runtime to alleviate this issue in the future and I also added the directory to the path so it's easier to start Cassandra and related tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment