Monday, April 07, 2014

Installing Jenkins Server on Google Cloud Platform

The goal of this short post is to show how to spin a Jenkins server on Google Cloud Platform.

Create a new instance

This is a simple one. Browse to your Google Cloud console https://console.developers.google.com and create a new instance. Make sure you:

  1. Select a small (or greater) instance type. 
  2. Select Debian as your OS. 
  3. If you have a network rule that enables TCP 8080 then use it. Otherwise, you can configure this later on to your default rule.

Install Jenkins

To use the Debian package repository of Jenkins, first add the key to your system:
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
Then add the following entry in your /etc/apt/sources.list:
deb http://pkg.jenkins-ci.org/debian binary/
Update your local package index, then finally install Jenkins:
sudo apt-get update
sudo apt-get install openjdk-7-jre
sudo update-java-alternatives --set java-1.7.0-openjdk-amd64
sudo apt-get install jenkins

Configure the default network rule

In Google Cloud Console go to your project and select Compute Engine | Networks | Firewall rules. Create a new rule. Include tcp:80,8080 to your "Allowed Protocols or Ports"

That's it! Browse to your instance external IP and concatenate :8080.