- 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
- Create a project Manually to scan
- Clone the repo
https://github.com/Ramkhushi/calcwebapp.git
- Copy the complete command and run this in your clone Repo
- 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
- 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".
-
Create a token in Sonarqube from administrator >Myaccount ->Security and generate a Global Token
-
Create credentials for this token in jenkins
-
Configure Sonarqube in jenkins
-
Install Sonarqube Scanner
-
Go to ->Manage Jenkins ->Tools- >SonarQube Scanner
-
Create job in jenkins now
- 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



















