How to setup SonarQube

Posted By : Harikesh Maurya | 30-Sep-2019


SonarQube is an open-source tool that is used to analyze code quality and reporting. It scans your source code file and looking for potential bugs, vulnerabilities, and maintainability issues in your application.



  1. Download the zip file 

    sudo wget 
  1. Unzip the file sudo

  2. Now we need to configure your database in sonar properties file.

     sudo vi sonarqube-7.0/conf/
  1. Next, you need to tell about the database driver. Here I am using mysql

  1. Add this line in sonarqube properties file to run in server mode and only listen to the local address:

  1.  And finally start sonar qube

sonarqube-7.5/bin/<your_os>/ start
  1. Now check http://localhost:9000 it start working.


SonarQube default administrator username and password is admin. So you need to change because it is not secure.


  1. Once you logged in, click the Administration tab, select Security from the dropdown list, and then select Users.

  2. Click on the create user button 

  3. Then create a token for a specific user by clicking on the button in the “Tokens” column and sure to write it down in a safe place we are using it in the future for code scanner.


SonarQube’s code scanner is a different package that you can install on your machine or on a different machine and then need to connect one SonarQube server.


Let’s  see how to install 

1. Download the zip file 

sudo wget

2. Extract the zip file

sudo unzip

3. After that, you need to update a few settings to get the scanner working. Open the configuration file.

vi sonar-scanner-

4. So first we need to add SonarQube server URL in the file. Uncomment the line starting with

5. Change the permission to execute the binary

chmod +x sonar-scanner-

6. Now create a symbolic link so that we can call the scanner without specifying the path:

sudo ln -s /opt/sonarscanner/sonar-scanner- /usr/local/bin/sonar-scanner


Now you setup has been completed, its time to scan your code:- 

  1. So for that, we need to create a file with these configurations





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




  1. Then, just run the scanner 

sonar-scanner -D sonar.login=your_token_here
  1. Now finally, your report is ready you can check in your browser http://localhost:9000/dashboard?id=<your_app_name>




About Author

Author Image
Harikesh Maurya

Harikesh is an Experienced Software Engineer with a demonstrated history of working in the information technology and services industry. Skilled in Java Enterprise Edition, Java, Spring Boot, Spring Security, and Hibernate. He has a good sense of humor.

Request for Proposal

Name is required

Comment is required

Sending message..