Sunday, May 14, 2017

Install Sonarqube on Ubuntu Part-1

Hello Guys,

Today I will show you how to install the sonarqube on ubuntu box and then will go with some configuration of sonarqube so lets start.

Lets install  JDK 8 on ubuntu

$ sudo apt-get install oracle-java8-installer

now lets install mysql on ubuntu

$ wget
$ sudo dpkg -i mysql-apt-config_0.6.0-1_all.deb

This will install the repo of mysql 5.7 on ubuntu server and now lets install mysql server sometimes unzip utility is not present on the server ubuntu server so install it exploratory. 

$ sudo apt-get update && sudo apt-get install mysql-server && sudo apt-get instll unzip zip

Create SonarQube database and user

$mysql -u root -p
Then create the database and a user:
mysql> CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> CREATE USER 'sonar' IDENTIFIED BY 'sonar';
mysql> GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
mysql> GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
mysql> exit; 

So We have completed  prerequisite now lets move ahead with the installation of sonarqube
Download the latest source of sonarqube from
in my case its 6.3.1
$ wget
$ unzip
$ sudo sonarqube-6.3.1 /opt/sonar


Open /opt/sonar/conf/ with your favourite text editor, and modify my case its vim so

$ vim /opt/sonar/conf/

MySQL settings
Uncomment the user credentials and the MySQL related settings:



Web Server settings
The following settings allow you to run the server on page http://localhost:9000/sonar
Copy to etc/init.d/sonar and modify it according to your platform.

$ sudo cp /opt/sonar/bin/linux-x86-64/ /etc/init.d/sonar
$ sudo vim /etc/init.d/sonar

Insert two new lines:


Modify the following lines:


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

now lets rock and role as the sonar is install on your local so lets start it with

$ /etc/init.d/sonar start

open the browser and http://<ip-address of server>:9000

remaing configuration section i will show you in the next article .