Jenkins installation


You can install Jenkins in 2 different manners:

  • As a Linux package (apt-get ...)
  • As a standalone WAR package


Installation (Ubuntu)

The following instructions are for Ubuntu 14.04 LTS.

You can find all these instructions and more on the official wiki page: https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu


!! NOTE: Jenkins updates are not always very good. Be careful when you run apt-get upgrade !!


Get package

cd /tmp
wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins


Service configuration

To adjust root path and port you just need to edit the service launcher.

vim /etc/default/jenkins


Adjust the default values:

# port for HTTP connector (default 8080; disable with -1)
HTTP_PORT=8080

# port for AJP connector (disabled by default)
AJP_PORT=8009

# servlet context, important if you want to use apache proxying
PREFIX=/jenkins-guillaume

JENKINS_ARGS="--webroot=/var/cache/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --prefix=/jenkins-guillaume"


Restart the service

sudo service jenkins restart


Test it! Go to http://localhost:8080/jenkins-guillaume


Firewall

Edit your firewall script and add:

IPTABLES=`which iptables`

$IPTABLES -A INPUT -p tcp --dport 8080 -j ACCEPT                # Web container
$IPTABLES -A OUTPUT -p tcp --dport 8080 -j ACCEPT               # TomCat (Java Web Server)


Of course, if you already have a Tomcat server you need to adjust these ports.


Adjust jobs directory

Jenkins requires a lot of space to keep builds, versions and so on... By default everything goes into /var/lib/jenkins


To use another directory, such as /home/jenkins:


1. Create jobs directory

mkdir /home/jenkins
chmod -R 777 /home/jenkins
chown -R jenkins:jenkins /home/jenkins


2. Edit configuration file

vim /etc/default/jenkins

Set the JENKINS_HOME variable

JENKINS_HOME=/home/jenkins


Restart service

service jenkins restart



Installation (war)

Just download the latest WAR and deploy it on your Tomcat.


Jenkins CI: http://jenkins-ci.org/