Install Jenkins

Install

#!/bin/bash

# install required packages
apt-get install -y wget

# add repository key
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add -

# add repository
echo "deb http://pkg.jenkins-ci.org/debian binary/" > /etc/apt/sources.list.d/jenkins.list
apt-get update

# install jenkins
apt-get install -y jenkins
>

Jenkins Debian weekly repository
deb https://pkg.jenkins.io/debian binary/

Jenkins Debian LTS repository
deb https://pkg.jenkins.io/debian-stable binary/

Manuall plugins download
http://updates.jenkins-ci.org/download/plugins

disk-usage plugin
apt-get install -y fontconfig
https://wiki.jenkins-ci.org/display/JENKINS/Disk+Usage+Plugin

workspace
/var/lib/jenkins/workspace

manual update
wget http://updates.jenkins-ci.org/download/war/latest/jenkins.war -O /usr/share/jenkins/jenkins.war
/etc/init.d/jenkins restart
tail -f /var/log/jenkins/jenkins.log

Jenkins CLI
http://www.panticz.de/jenkins-cli

Plugins
# configure plugins
http://YOUR_JENKINS_IP:8080/pluginManager/available

# Locale plugin
https://wiki.jenkins-ci.org/display/JENKINS/Locale+Plugin
Manage Jenkins > Configure System
Locale
Default Language: en
Ignore browser preference and force this language to all users (check)

# Git plugin
https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin

MySQL JDBC driver to Jenkins (works with Jenkins jobs AND in Jenkins Script Console / Scriptler)
mkdir /usr/java/packages/lib/ext
ln -s /var/lib/jenkins/lib/java /usr/java/packages/lib/ext
wget http://cdn.mysql.com/Downloads/Connector-J/mysql-connector-java-5.1.33.tar.gz -P /tmp
tar xzf /tmp/mysql-connector-java-5.1.33.tar.gz -C /tmp/
cp /tmp/mysql-connector-java-5.1.33/mysql-connector-java-5.1.33-bin.jar /var/lib/jenkins/lib/java/

# howtos
for (item in Hudson.instance.items) {
println("$item.name")
}

java -jar hudson-cli.jar -s http://your_Hudson_server/ copy-job myjob copy-myjob

# port forward
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu

# ssl
# /etc/default/jenkins
JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpsPort=8443 --httpsCertificate=/etc/ssl/certs/www.example.com.pem --httpsPrivateKey=/etc/ssl/www.example.com.pem"

iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443

Build options
# skip build javadoc
-Dmaven.javadoc.skip=true

Configuration SonarQube
/var/lib/jenkins/.m2/settings.xml

Links
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu
http://pkg.jenkins-ci.org/debian/