SonarQube Tutorial
SonarQube Tutorial
Install SonarQube and sonarScanner from the given links for respective OS
Both SonarQube and Sonar Scanner should be extracted on a single file on the C drive (any
drive of your choice)
Go to the specific folder, where both extracted SonarQube and SonarScanner folders are
present. Open on sonarqube-10.5.0.89998>> conf >> sonar.properties as a text file on
notepad.
Search ‘sonar.web.host=0.0.0.0’ on the notepad and uncomment the line.
Again, search ‘sonar.web.port=9000’ on that notepad and uncomment the line. Also change
to port from 9000 to other numbers like 9099 [anything you can add . 9099 is just an
example]
Save and close the file.
Open on sonar-scanner-5.0.1.3006-windows>> conf >> sonar.scanner.properties as a text
file on notepad.
Search ‘sonar.host.url=http://localhost:9000’, uncomment it, and change the port to the
same as SonarQube properties changed the port to 9099.
As we will be using local codebase for static analysis keep your code base folder within of
the same folder for easy access( you can also use codebase from github aur any cloud
service directly after creating the project in SonarQube)
Go to the sonarStart.bat file inside the SonarQube folder inside the bin folder in it and click
on it to start the SonarQube.
Once started access the web through the port provided in my case http://localhost:9099.
Login to it the initial credentials allocated will be “admin” as both for username and
password, once logged in you will directed to the change password page.
Once logged in you have create your project name it and then generate token.
Select Analysis Method (locally in our case)
Now go to C:\Software\sonar-scanner-cli-5.0.1.3006-windows\sonar-scanner-5.0.1.3006-
windows\bin and open command prompt
Now paste the copied command and in sources paste the path to your codebase and at the
end of that command paste the same path of your codebase as base directory and press
enter.
Once it will show analysis is done link will be provided in the cmd where you can view the
report.
There will have a dashboard providing the analysis done on the code and issues detected,
when you will clock on the issue you have a report stating the kind and severity of the issue
and its possible fix.