Step 2:SonarQube uses database to store the settings, rules, metrics, issues etc… It supports MSSQL Server, MySql, Oracle and PostgreSQL. In this article we are going to use MySql. We will create a database and assign the privileges to it.

CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'sonar' IDENTIFIED BY 'sonar123';
GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar123';
GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar123';

Step 3: Goto the “conf” folder (see Step 1) and configure the database details as part of sonar.properties file as shown below.

Step 4: Goto the “bin” folder (see Step 1) and choose the right operating system folder to start the Sonar. I have chosen “windows-x86-64” and clicked on “StartSonar.bat”. First time it will take some time to start as it is going to create tables in the configured database and setting up the default data. The sonar server runs on 9000 port by default and the sonar host URL will be http://localhost:9000

Step 5:Download the SonarQube Runner to analyze the code, unzip it and set the SONAR_RUNNER_HOME environment variable to the root folder of Sonar Runner.

Step 6: Set the PATH variable to SONAR_RUNNER_HOME/bin and ensure the JAVA_HOME set properly.