Revision as of 11:59, 10 September 2014 by WikiFreak (talk | contribs)

The following instructions are for Ubuntu 14.04 LTS.

You can find all these instructions and more on the Official how-to:


You need to have a MySQL server available.

Installation (Ubuntu)

Get package

vim /etc/apt/sources.list

Add a new repository

deb binary/

Update packages list and install sonar

apt-get update
apt-get install sonar

Create SONAR database

SONAR needs to work with a database.

You can create a new MySQL database + MySQL user for it.

Step 1: Login to MySQL as ROOT

mysql -u root -p
Enter password:

Step 2: Create the Database

mysql > create database sonar;

Step 3: Verify that it’s there

mysql > show databases;

Step 4: Create the User

mysql > create user sonar;

Step 5: Grant privileges while assigning the password

mysql > grant all on sonar.* to 'sonar'@'localhost' identified by 'sonar';

Step 6: Apply changes

mysql > flush privileges;

Step 7: exit

mysql > quit;

Configure SONAR

Edit SONAR configuration file

vim /opt/sonar/conf/

Database configuration

Disable embedded H2DB and enable MySQL database, lines 20 to 40:


Port number and root context

Adjust port number and context   
#sonar.web.port:             9000
sonar.web.context:           /sonar

!!! This is VERY important that you uncomment and set the sonar.web.context !!!

Restart Sonar

service sonar restart

... wait for some times on 1st start (5 to 7 mn) !!

Check that Sonar is up

netstat -pl --numeric | grep 9000

You should have:

tcp        0      0  *               LISTEN      xxxxx/java

Add apache2 proxy rule Sonar access will be done through Apache2 server To use the proxy rule, the target /sonar must match the root URL (see

vim /etc/apache2/mods-enabled/proxy.conf </syntaxhighlight>

  1. Proxy to a Java application running over Tomcat, with IP filter

<Location /sonar> ProxyPass http://localhost:9000/sonar ProxyPassReverse http://localhost:9000/sonar

       ### Apache < 2.4

#Order allow,deny #Allow from

       ### Apache 2.4
       Require local
       Require ip 192.168.1
       Require host


Test Sonar Navigate to http://myServer:9000/sonar or http://myServer/sonar

The default user and password are “admin” and “admin“.

Logs Sonar logs are in: /opt/sonar/logs/sonar.log

Upgrade Sonar Sometimes when there are a lot of changes the new sonar version required some database change. The service will not be available until you go to http://myServer/sonar/setup You have to agree to the terms and upgrade database