How to Install SonarQube Server?

Get Started in Two Minutes

  1. Unzip - let's say in "C:\sonarqube" or "/etc/sonarqube", the SonarQube distribution once it's downloaded. (Download Page)
  2. Start the SonarQube server:
  3. 1234567
    	# On Windows, execute:
    	C:\sonarqube\bin\windows-x86-xx\StartSonar.bat
    				 
    	# On other operating system, execute:
    	/etc/sonarqube/bin/[OS]/sonar.sh console
    			
  4. Log in to http://localhost:9000 with System Administrator credentials (admin/admin) and follow the tutorial to analyze your first project.

How to Install/Configure SonarQube Scanner?

Installation

  1. Expand the downloaded file into the directory of your choice. We'll refer to it as <install_directory> in the next steps.
  2. Update the global settings to point to your SonarQube server by editing <install_directory>/conf/sonar-scanner.properties:
  3. 1234
    	#----- Default SonarQube server
    	#sonar.host.url=http://localhost:9000
    				
  4. Add the <install_directory>/bin directory to your path.
  5. You can verify your installation by opening a new shell and executing the command sonar-scanner -h (on Windows platform the command is sonar-scanner.bat -h) . You should get output like this:
  6. 123456789
    	usage: sonar-scanner [options]
     
    	Options:
    	 -D,--define      Define property
    	 -h,--help             Display help information
    	 -v,--version          Display version information
    	 -X,--debug            Produce execution debug output			
    				

If you need more debug information you can add the sonar.verbose property by adding the command line parameter -Dsonar.verbose=true.

How to download sample projects?

Use

Create a configuration file in the root directory of the project: sonar-project.properties

sonar-project.properties

1234567891011121314
	# must be unique in a given SonarQube instance
	sonar.projectKey=my:project
	# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
	sonar.projectName=My project
	sonar.projectVersion=1.0
	 
	# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
	# This property is optional if sonar.modules is set. 
	sonar.sources=.
	 
	# Encoding of the source code. Default is default system encoding
	#sonar.sourceEncoding=UTF-8
			

How to run?

Run the following command from the project base directory to launch the analysis:

1234
	sonar-scanner	

		
  Call us on +91 700 483 5930   |   +91 700 483 5706     Contact@DevopsSchool.com