Skip to content

Latest commit

 

History

History
139 lines (103 loc) · 4.49 KB

File metadata and controls

139 lines (103 loc) · 4.49 KB

Sonarqube Server Installation Steps on Linux

  • Install wget if this is not available
yum install wget -y
  • Download the sonarqube software
wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-9.5.0.56709.zip
  • Install unzip command
yum install unzip -y
  • unzip the newly downloaded software
unzip sonarqube-9.5.0.56709.zip
  • Move to sonarqube dir
cd sonarqube-9.5.0.56709/bin/linux-x86-64
  • Now java version 11 or later
 yum install java-11-openjdk*
  • Now start the sonarqube with standard user

 ./sonar.sh start
 ./sonar.sh status
  • Default user name and Password
admin
admin
  • Default port number of Sonarqube
9000
  • User Sonarqube with maven

image

  • Create a project Manually to scan

image image image image image image image

  • Clone the repo
https://github.com/Ramkhushi/calcwebapp.git
  • Copy the complete command and run this in your clone Repo

image

  • Move to the repository
cd calcwebapp

mvn clean verify sonar:sonar \
  -Dsonar.projectKey=test-scan \
  -Dsonar.host.url=http://34.125.10.239:9000 \
  -Dsonar.login=sqp_c50250e9748708bb19ebd57141221ab7aec55dea
  • Go back to your Sonarqube and check the data

image

  • Disable Authentication if you need to run this without creds
Go to sonarqube web page, then go to administration, after that go to security and disable " Force User Authentication".

Sonarqube and Jenkins

  • Install sonarqube plugin image

  • Create a token in Sonarqube from administrator >Myaccount ->Security and generate a Global Token

  • Create credentials for this token in jenkins

  • Go to Manage jenkins ->credentials image image

  • Configure Sonarqube in jenkins

  • Go to -> Manage Jenkins -> System-> SonarQube servers image image

  • Install Sonarqube Scanner

  • Go to ->Manage Jenkins ->Tools- >SonarQube Scanner

  • image image

  • Create job in jenkins now

image image image


Sonarqube Agent Configuration

  • Download the sample code
git clone https://github.com/monbostest/java-sonar-runner-simple
  • Download Sonaqube runner
https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/
https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip
  • Run sonarqube scanner against the code
/root/sonar-scanner-4.7.0.2747-linux/bin/sonar-scanner