Published on 18 Sep 2015
After installation of Ubuntu 14.04 LTS, as root (just like every other commands here):
/opt
$ ln -s jdk1.8.0_60 java-1.8
$ ln -s java-1.8 java
/opt
$ ln -s apache-maven-3.3.3 maven
$ wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add -
$ sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
$ apt-get update
$ apt-get install jenkins
$ apt-get install apache2
$ a2enmod proxy
$ a2enmod http_proxy
/etc/apache2/sites-available/jenkins.conf
with content below$ a2ensite jenkins
$ apache2ctl restart
#### Virtual host file
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName ci.company.com
ServerAlias ci
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost on
ProxyPass / http://localhost:8080/ nocanon
AllowEncodedSlashes NoDecode
</VirtualHost>
$ apt-get install mysql-server
/opt
$ ln -s sonarqube-5.1.2 sonar
$ ln -s /opt/sonar/bin/linux-x86-64/sonar.sh /usr/bin/sonar
$ mysql -u root -p
mysql> CREATE DATABASE IF NOT EXISTS sonar CHARACTER SET utf8 COLLATE utf8_bin;
mysql> CREATE USER 'sonar'@'%' IDENTIFIED BY 'sonar';
here you may use a different password…mysql> GRANT ALL ON sonar.* TO 'sonar'@'%';
mysql> quit;
/opt/sonar/conf/sonar.properties
):
/opt/maven/conf/settings.xml
) with content below in the <profiles>
section/etc/init.d/sonar
with content below$ chmod 755 /etc/init.d/sonar
$ update-rc.d sonar defaults 98 02
/etc/init.d/sonar start
to start sonar/etc/init.d/sonar
#!/bin/sh
/usr/bin/sonar $*
#### Sonar profile in /opt/maven/conf/settings.xml
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.jdbc.url>
jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
</sonar.jdbc.url>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<!-- Optional URL to server. Default value is http://localhost:9000 -->
<sonar.host.url>
http://myserver:9000
</sonar.host.url>
</properties>
</profile>
make sure you have jacoco 0.7.5.201505241946 and sonar’s Java plugin >= 3.4 otherwise it wont work. You’ll get something like
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project ...: Unable to read .../target/jacoco.exec: Incompatible version 1007. -> [Help 1]
If you followed all the steps, you should be all set! It’s time to trigger a build