How to Install Jenkins-sonar-learning

SonarQube is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs, code smells, and security vulnerabilities on 20+ programming languages.

To Install Java

sudo apt update
sudo apt install openjdk-8-jdk

To Install Jenkins

sudo apt update
wget -q -O — https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c ‘echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list’
sudo apt-get update
sudo apt-get install jenkins

To start Jenkins

sudo service jenkins start

Install Maven, CodePipeline plugin

Configure Maven Configure Java

sudo update-alternatives — config javac/usr/lib/jvm/java-8-openjdk-amd64

https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu

To Install Sonar

http://sonar-pkg.sourceforge.net/

Add the following entry in your /etc/apt/sources.list :

deb http://downloads.sourceforge.net/project/sonar-pkg/deb binary/

Update your local package index and install Sonar:

sudo apt-get update
sudo apt-get update
sudo apt-get install sonar

To configure Mysql for Sonar

http://dev.mamikon.net/installing-sonarqube-on-ubuntu/
sudo apt-get install mysql-server
mysql -u root -p
CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER ‘sonar’ IDENTIFIED BY ‘sonar’;
GRANT ALL ON sonar.* TO ‘sonar’@’%’ IDENTIFIED BY ‘sonar’;
GRANT ALL ON sonar.* TO ‘sonar’@’localhost’ IDENTIFIED BY ‘sonar’;

FLUSH PRIVILEGES;

Open /opt/sonar/conf/sonar.properties

sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

To start sonar

sudo /etc/init.d/sonar start