Category Archives: sonar

upgrade sonar 3 to 4

so easy as 5 simple steps :
– Download and unzip new : > unzip -d $NEW_SONAR_HOME
– Manually edit sonarqube-4.0/conf/ and sonarqube-4.0/conf/wrapper.conf and copy old properties values from old sonar conf
– Copy extensions from old sonar to the new one (only extensions not having correspondent in the new sonar)
– stop old sonar and start the new one :
> $OLD_SONAR_HOME/bin/yourOS/ stop
> $NEW_SONAR_HOME/bin/yourOS/ start
– Go to http://localhost:9000/setup (assuming sonar listen in localhost) and finally click under upgrade button

losing sonar admin password

by default sonar creates admin account : user: admin, password : admin
when sonar admin password is changed and lost, simple way to reinitialize password to admin is with a simple sql command :
> musql -u sonar -p
mysql> use sonar
mysql> update users set crypted_password = ’88c991e39bb88b94178123a849606905ebf440f5′, salt=’6522f3c5007ae910ad690bb1bdbf264a34884c6d’ where login = ‘admin’
that’s all.

sonarQube and sonarRunner + mysql

Analyse sonarQube standalone server :
First of all prepare your mysql user sonar :

> mysql -uroot -p

    > use mysql;
    > create user sonar identified by ‘sonar’;
    > update user set host=’%’ where user = ‘sonar’;
    > create database sonar;
    > grant all privileges on sonar.* to sonar;
    > flush privileges;
    > quit

– download
– unzip :

> unzip -d /path/where/to/extract/

– declare 
– edit /extracted/sonar/path/conf/
       1. comment     : sonar.jdbc.url:                            jdbc:h2:tcp://localhost:9092/sonar
       2. uncomment : sonar.jdbc.url:                            jdbc:mysql://[…]
– start sonar server : > /extracted/sonar/path/bin// start
– download
– unzip :

> unzip -d /path/where/to/extract/

– add environment variable SONAR_RUNNER_HOME: (ubuntu) edit /etc/environment and add SONAR_RUNNER_HOME=/sonar-runner/home/path/ 
– add $SONAR_RUNNER_HOME/bin to PATH : (ubuntu) edit /etc/environment and edit PATH
– go to your project home directory
– create file
– copy following in
# required metadata

# optional description
sonar.projectDescription=Fake description

# path to source directories (required)

# The value of the property must be the key of the language.

# Encoding of the source code

# Additional parameters

– finally analyse your project :

> sonar-runner