Revision as of 10:01, 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/

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

Disable embedded H2DB and enable MySQL database

sonar.jdbc.username:         sonar				             line 41
sonar.jdbc.password:         sonar
# sonar.jdbc.url:            jdbc:h2:tcp://localhost:9092/sonar	             line 49

Restart Sonar

/etc/init.d/sonar start

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

Check that Sonar is up 

<syntaxhighlight lang="bash">
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

  1. vim /etc/apache2/mods-enabled/proxy.conf


       # Service SONAR runs on a different port
       ProxyPass /sonar http://localhost:9000/sonar
       ProxyPassReverse /sonar http://localhost:9000/sonar

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