The objective of this post is to present the installation of Jenkins. It will be the opportunity to detail the resolution of some problems specific to our environment.
Installation of Jenkins
There are several manners to install Jenkins. According to our environment, we chose to download from the Jenkins web site a file jenkins.war.
As for the installation of Sonar, we just have to copy this file under C:\Program Files ( x86 ) \Apache Software Foundation\Tomcat 7.0\webapps, (re-)start Tomcat, then to start Jenkins from its url and…
Nothing. My browser runs, runs, runs… I stop and restart Tomcat again, nothing works. Even Sonar that was previously available will no longer start.
Looking in the directory ..\Apache Software Foundation\Tomcat 7.0\ logs, we notice a file tomcat7-stderr.xx.log (xx is the current date) and if you open it, one (or more) message(s) java.lang.OutOfMemoryError: PermGen space.
We need to update our Tomcat configuration, as follows:
- Start Tomcat7w.exe.
- In the tab Java, enter the following option -XX:MaxPermSize=256m.
We can now relaunch Tomcat and enter into Jenkins. Notice my interface in Spanish: the language is automatically parametrized according to the corresponding variable of the browser.
Well, first thing now is to have a look on the configuration of Jenkins, by clicking the administration menu (‘Administrar Jenkins’ in my case).
Jenkins Configuration
In the administration page, a message warns us that our Tomcat is not UTF-8 compatible. No need to go into details, a link Tomcat i18n open an help page on the Jenkins web site, where we can discover how to solve this problem:
- In the folder ..\Apache Software Foundation\Tomcat 7.0\conf, look for the file server.xml.
- In this file, look for the section Connector and insert the following attribute: URIEncoding=”UTF-8″. This is how it looks in my file:
Stop/Start the service Tomcat and back in the administration page of Jenkins, the warning message has gone.
Let’s go to see now the parameters of configuration: the first thing which we notice is that Jenkins is installed in a directory C:\.jenkins. Oops, it is not exactly what I wish. I prefer to centralize my environment of analysis on a dedicated hard disk. Let’s see how to change the location of the Jenkins ‘repository’.
We need to specify a variable JENKINS_HOME. Two way to proceed for an installation such as ours. The first one is incorrect, but I indicate it nevertheless because this information is not easy to find:
- In the folder \Apache Software Foundation\Tomcat 7.0\webapps\jenkins\WEB-INF, find the web.xml file which is the entry point of our webapp Jenkins.
- In this file, insert the following section in order to declare the variable JENKINS_HOME on a directory F:\Jenkins.Well, avoid it completely as this is malpractice: this file and thus our modification will be overwritten in case we install a new jenkins.war, when we want to upgrade for example. So unless you want make this change with each new installation, it is better to proceed as this:
- In the folder \Apache Software Foundation\Tomcat 7.0\webapps\jenkins\WEB-INF, find the file context.xml and insert the following line:
<Environment name=”JENKINS_HOME” value=”C:/SRC/Jenkins/” type=”java.lang.String”/>
This time, we declare our ‘repository’ on C:\SRC\Jenkins, directly at the level of Tomcat and not anymore within the webapp Jenkins.
It is recommended to choose well this location before installing the plugin Sonar or starting to work with Jenkins. Indeed, if you change the ‘home’ of Jenkins, a new environment will be created and you will lose your existing configuration (except if you move your current repository to the new location).
The next post will be about the installation of the Sonar plugin for Jenkins.
This post is also available in Leer este articulo en castellano and Lire cet article en français.