Installing Jenkins on Ubuntu

compared with
Current by benoît tuduri
on Mar 03, 2015 12:42.

This line was removed.
This word was removed. This word was added.
This line was added.

Changes (12)

View Page History
Recent versions are available in [an apt repository|]. Older but stable LTS versions are in [this apt repository|].

You need to have a JDK and JRE installed. openjdk-6-jre and openjdk-6-jdk installed. openjdk-7-jre and openjdk-7-jdk are suggested. As of 2011-08 gcj is known to be problematic - see [|].

Please make sure to back up any current Hudson or Jenkins files you may have.

wget -q -O - | sudo apt-key add -
sudo sh -c 'echo deb binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
* The '{{jenkins}}' user is created to run this service.
* Log file will be placed in {{/var/log/jenkins/jenkins.log}}. Check this file if you are troubleshooting Jenkins.
* {{/etc/default/jenkins}} will capture configuration parameters for the launch like e.g JENKINS_HOME
* By default, Jenkins listen on port 8080. Access this port with your browser to start configuration.

If your {{/etc/init.d/jenkins}} file fails to start jenkins, edit the {{/etc/default/jenkins}} to replace the line
{noformat}HTTP_PORT=8080{noformat} by {noformat}HTTP_PORT=8081{noformat}
Here, 8081 was chosen but you can put another port available.

h1. Deploying on Ubuntu in a cloud (EC2, HP Cloud, OpenStack)

The Ubuntu Jenkins maintainer also maintains the [Juju charm deployment/management script|] for deployment in clouds. It's designed to make it easy to deploy a master with multiple slaves:
juju deploy jenkins
juju deploy -n 5 jenkins-slave
juju add-relation jenkins jenkins-slave

The default password for the 'admin' account will be auto-generated. You can set it using:

juju set jenkins password=mypassword

Always change it this way - this account is used by the charm to manage slave configuration. Then feel free to expose your jenkins master:
juju expose jenkins

h1. Setting up an Apache Proxy for port 80 \-> 8080

* {{sudo a2enmod proxy}}
* {{sudo a2enmod proxy_http}}
* {{sudo a2enmod vhost_alias}}

{note}do not do this next command if you already have virtual hosting setup that depends on the default site. See my comment below - danapsimer{note}
* {{sudo a2dissite default}}
* {{Create a file called}} {{{+}jenkins{+}}} {{in}} /etc/apache2/sites-available
* Create a file called {{jenkins.conf}} in {{/etc/apache2/sites-available}}

ProxyPreserveHost on
ProxyPass / http://localhost:8080/ nocanon
AllowEncodedSlashes NoDecode

* *Install Nginx*.
cd /etc/nginx/sites-available
sudo rm default ../sites-enabled/default
* *Create new configuration for Jenkins*. This example uses {{cat}}, but you can use your favorite text editor. Make sure to replace '' with your domain name.