Installing Jenkins
Jenkins can mainly be installed in two different ways. One way is using the native package for the installation and the other one is to deploy the Jenkins war file into a servlet container like tomcat. The Jenkins war file can be downloaded directly from http://mirrors.jenkins-ci.org/war/latest/jenkins.war. For details about Jenkins CI please visit http://jenkins-ci.org/.
Here
we will use the second option that is downloading and deploying the
Jenkins war file into a servlet container. We will be using Tomcat as
a servlet container where the downloaded Jenkins war file will be
deployed.
Also
remember that we need to define JENKINS_HOME environment variable
that points to the location from where Jenkins loads all of its
configuration.
It is better to define this
environment variable on servlet container level by placing the
following line in $CATALINA_HOME/config/context.xml so that it will
remain there even if a newer version of Jenkins is deployed on Tomcat
server.
<Environment
name="JENKINS_HOME" value="/home/atif/Jenkins/"
type="java.lang.String"/>
Having added the above line in $CATALINA_HOME/config/context.xml and deployed Jenkins war file; restart the tomcat server. Now the Jenkins server should be up and running as depicted under.
snapshot 1 |
In the above snapshot a
message warns us that our Tomcat is not UTF-8 compatible. The link
Tomcat
i18n on the right side opens a help page on the Jenkins web
site, where the solution for the
above problem is mentioned.
In
the $CATALINA_HOME/config/server.xml file look for the section
Connector and insert the following attribute:
URIEncoding=”UTF-8″. This is how it looks in my file:
snapshot 2 |
The
second warning informs us that a newer version of Jenkins war file is
available for download. Simply download it from the link appearing in
the warning message and redeploy the updated Jenkins war file.
Installing Sonar Plugin for Jenkins
First
access the Jenkins server from the browser and navigate to Manage
Jenkins → Manage Plugins screen as shown below.
snapshot 3 |
Now
select the sonar plugin and click on 'Install without restart' button
as shown below.
snapshot 4 |
The
sonar plugin installation will take some time and once it is
installed the installation success message will appear on the UI
which is shown in below snapshot.
snapshot 5 |