jenkins the definitive guide

(Jeff_L) #1

repositories because of the high frequency of updates. First, you need to add the key to your system
as shown here:


$ wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key \
| sudo apt-key add -
$ sudo echo "deb http://pkg.jenkins-ci.org/debian binary/" > \
/etc/apt/sources.list.d/jenkins.list

Now, update the Debian package repository:


$ sudo aptitude update

Once this is done, you can install Jenkins using the aptitude tool:


$ sudo aptitude install -y jenkins

This will install Jenkins as a service, with a correctly configured startup script in /etc/init.d/
jenkins and a corresponding system user called “jenkins”. If you didn’t already have Java installed on
your server, it will also install the OpenJDK version of Java. By default, you will find the Jenkins WAR
file in the/usr/share/jenkins directory, and the Jenkins home directory in /var/lib/jenkins.


The installation process should have started Jenkins. In general, to start Jenkins, simply invoke this
script:


$ sudo /etc/init.d/jenkins start

Jenkins will now be running on the default port of 8080 (http://localhost:8080/).


You can stop Jenkins as follows:


$ sudo /etc/inid.d/jenkins stop

Jenkins will write log files to /var/log/jenkins/jenkins.log. You can also fine-tune the
configuration parameters in the /etc/default/jenkins file. This is useful if you need to modify
the Java startup arguments (JAVA_ARGS). You can also use this file to configure arguments that will
be passed to Jenkins in this file, such as the HTTP port or web application context (see Section 3.8,
“Running Jenkins as a Stand-Alone Application”).


3.6. Installing Jenkins on Redhat, Fedora, or CentOS


There are also native binary packages available for Redhat, Fedora, and CentOS. First you need to set
up the repository as follows:


$ sudo wget -O /etc/yum.repos.d/jenkins.repo \
http://jenkins-ci.org/redhat/jenkins.repo
$ sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
Free download pdf