Setting up SonarQube server

To setup the Sonarqube server on the EC2 instance, use the following commands:

sudo apt install unzip
sudo su -
adduser sonarqube
sudo su - sonarqube
wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-9.4.0.54424.zip
unzip *
chmod -R 755 /home/sonarqube/sonarqube-9.4.0.54424
chown -R sonarqube:sonarqube /home/sonarqube/sonarqube-9.4.0.54424
cd sonarqube-9.4.0.54424/bin/linux-x86-64/
./sonar.sh start

The SonarQube server can be accessed using the following URL:

http://<ip address of instance>:9000

Enter both username and password as "admin" and change the password after logging in.

SonarQube homepage

Go to Profile > Security and generate a new token which will be used in the Jenkins pipeline.

Generating a token for Jenkins

Inside Jenkins Dashboard, go to Manage Jenkins > Credentials > System > Global Credentials and add a new credential. Set the Kind as Secret Text and paste the SonarQube token and put the ID as "sonarqube". This ID is used to fetch the token in the Jenkinsfile.

Last updated