How to install sonar runner in unbuntu.

Create database and user:

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;
 

Download and unzip Sonar distribution:

wget http://dist.sonar.codehaus.org/sonarqube-5.1.zip
unzip sonarqube-5.1.zip
mv sonarqube-5.1 /opt/sonar
 

Edit sonar.properties:

Open /opt/sonar/conf/sonar.properties with your favourite text editor, and modify it.

MySQL settings:

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

Web Server settings:
sonar.web.host=127.0.0.1
sonar.web.port=9000
 
Implement Sonar server as a service:
sudo cp bin/linux-x86-64/sonar.sh /etc/init.d/sonar
sudo gedit /etc/init.d/sonar
 
Insert two new lines: 
SONAR_HOME=/opt/sonar
PLATFORM=linux-x86-64
 
Modify the following lines:
 
WRAPPER_CMD="${SONAR_HOME}/bin/${PLATFORM}/wrapper"
WRAPPER_CONF="${SONAR_HOME}/conf/wrapper.conf"
PIDDIR="/var/run" 

Register as a Linux service:
 
sudo update-rc.d -f sonar remove
sudo chmod 755 /etc/init.d/sonar
sudo update-rc.d sonar defaults
 

Create Desktop icons:

Install gnome-panel if missing:
sudo apt-get install gnome-panel --no-install-recommends
 
Open Dialog for creating new item for starting SonarQube:
sudo gnome-desktop-item-edit /usr/share/applications/ --create-new
 
Copy the item to the Desktop:
sudo cp /usr/share/applications/SonarQube\ Start.desktop /home/user/Desktop/
 
Open Dialog for creating new item for stopping SonarQube:
sudo gnome-desktop-item-edit /usr/share/applications/ --create-new
 
Copy the item to the Desktop:
sudo cp /usr/share/applications/SonarQube\ Stop.desktop /home/user/Desktop/
 
To start sonar server:
clicking on the SonarQube Start icon which was created before
To start sonar server:
clicking on the SonarQube Stop icon which was created before  

Lets enjoy...
 

 

 

 

 

 

 

 

Comments