How to Install SonarQube on Windows [4 Steps]

In this article we are going to cover What is SonarQube, SonarQube Architecture, Download and Install Oracle Java 17 on Windows, How to Install SonarQube on Windows, Start SonarQube on Windows,Access SonarQube on Windows.

What is SonarQube ?

SonarQube is a Code Quality Assurance tool that collects and analyzes source code, and provides reports for the code quality of your project.

SonarQube Architecture

How to Install SonarQube on Windows [4 Steps] 1

SonarQube Architecture can be classified in four components

1. Sonar Scanner 

  • Previously known as sonar runner. 
  • Ideally you need to use any of the built-in tools such as ant, maven or gradle that invokes the Sonar Scanner to fetch the source code. It takes the source code from the repository or a configuration parameter is used to set the place from which you want the source code to be taken. SonarQube cube supports plugins like SVN and some of the other version control system such as git etc. You can stuff with any build tools that are the integration tool, so you don’t have to offer the direction every time, because the build tool automatically pulls the software from the database. 

2. Source Code 

  • The source code is the code written by developer or manager. 
  • The code is then pushed to repository. 
  • Pull Requests (PRs) are visible in SonarQube 

3. Sonar Analyzer 

  • Sonar analyzer takes the source code you would like to analyze and go through all the code and gives you technical problems 
  • Sonar receives the request and starts to examine the source code of the project. The analysis is based on the project’s Sonar profile activating any additional plugins or reporting capabilities, if any. 
  • You simply need to integrate these plugins into your sonar qube and the sonarqube will analyze the source code. 
  • You need to add these plugins to the sonar analyzer based on the language you want to analyze. 
  • When the analysis is finished, the results will be stored in database for future reference 

4. SonarQube Database 

  • It will be sent to the database once the report is generated so that it can be stored in the database and subsequently used for reporting purposes 
  • There is a caching server which is used to hold the temporary reports in the cache 
  • Once the sonar analyzer completes the analysis of the source code then it is going to send the this report to the queue where the server needs to be process those results 
  • After the results are processed then the report or the data will be stored in the database. SonarQube will have a default database 
  • You can integrate your own database our to your sonarqube 
  • Sonarqube supports various databases like a ms SQL Server, Oracle etc 

Prerequisites:

  • The SonarQube server requires Java version 17 
  • SonarQube server requires at least 2GB of RAM to run efficiently and 1GB of free RAM for the OS.

Step #1:Download and Install Oracle Java 17 on Windows

Go to Oracle Java Official site to download Java for Windows

Download Windows x64 MSI Installer.

After the double click on MSI installer file we get welcome to the  installation wizard for Java SE development kit 17.0.6 then click on next button again next and it will be install.

How to Install SonarQube on Windows [4 Steps] 2

Step #2:Download and Install SonarQube on Windows

Go to SonarQube official website to download SonaQube for Windows to download latest version.

Click on Download Community Edition.

How to Install SonarQube on Windows [4 Steps] 3

Step #3:Start SonarQube on Windows

we can set default Java executable by setting the environmental variable SONAR_JAVA_PATH.

setx SONAR_JAVA_PATH "C:\Program Files\java_home\bin\java.exe"
We have downloaded and extracted SonarQube in C:\ drive in windows
Go to C:\sonarqube-9.9.0.65466\bin\windows-x86-64 path, there is StartSonar window batch file right click on run as administrator.

How to Install SonarQube on Windows [4 Steps] 4

once clicked, we can see below output on Command Prompt

How to Install SonarQube on Windows [4 Steps] 5

OR

Another way to run StartSonar bat file on Windows command prompt

we can set default Java executable by setting the environmental variable SONAR_JAVA_PATH.

setx SONAR_JAVA_PATH "C:\Program Files\java_home\bin\java.exe"

Open command prompt Navigate to below path and run StartSonar.bat file

cd C:\sonarqube-9.9.0.65466\bin\windows-x86-64 
<SONARQUBE_HOME>/bin/windows-x86-64/StartSonar. bat
How to Install SonarQube on Windows [4 Steps] 6

Step #4:Access SonarQube on Windows

Go to any browser and type localhost:9000 . This page we get

localhost:9000 OR IP:9000
How to Install SonarQube on Windows [4 Steps] 7

SonarQube default username and password , login: admin and password: admin and click on login button.

once login it will ask to change password, update you password as your requirement.

How to Install SonarQube on Windows [4 Steps] 8

once password updated, you will navigate to SonarQube Dashboard as shown below.

How to Install SonarQube on Windows [4 Steps] 9

We have covered How to Install SonarQube on Windows.

Conclusion:

We have covered What is SonarQube, SonarQube Architecture, Download and Install Oracle Java 17 on Windows, How to Install SonarQube on Windows, Start SonarQube on Windows,Access SonarQube on Windows.

Related Articles:

How to Install SonarQube on Ubuntu 22.04 LTS

FOSS TechNix

FOSS TechNix (Free,Open Source Software's and Technology Nix*) founded in 2019 is a community platform where you can find How-to Guides, articles for DevOps Tools,Linux and Databases.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap