5/5 - (1 vote)

In this guide I want to set out a step-by-step setup for deploying a platform for continuous analysis and measurement of code quality. There are a lot of similar articles on the network, but I want to highlight only the main thing so that all newcomers can deal with it the first time.

You already learned the wiki, right?

And before we get started I want you to decide which version to implement for you, because with each update more and more plugins become paid, what, of course, will affect financial costs or functionality.

According to the documentation, it is recommended to keep the server and database on different machines.

But in the sandbox you can also train on one.

So. I work with virtual machines. Prepared 2 pieces, or rather raised one and made a duplicate of it.

Ubuntu server 18.04.3 LTS was at my fingertips.

You can change the name and ip easily and simply using these commands:

change hostname

change ip ubuntu

There,you are find the familiar lines and change the parameters of the machine name and IP address.

And what should happen:

Sonar app server [SonarApp]
user: admin
Platform: Ubuntu server 18.04.3 LTS [8 cores, 16GB of RAM, 20Gb + 50Gb (/opt) disk space]

Sonar database [SonarDB]
user: admin
Platform: Ubuntu server 18.04.3 LTS [8 cores, 16GB of RAM, 20Gb + 100Gb disk space]

Start of work

We go to the first machine – (SonarApp) NOT under root, but under its own admin account. Those lines that begin with the $ character are terminal input, and the rest is what we’ll edit in the files or what should be received on the output (information output)

  •  you need java. Take OpenJDK

Install open-jdk11

change java PATH

Download and configure SonarQube

Download the SonarQube installer files archive.

Install unzip by running:

Unzip the archive using the following command

Rename the directory

Add Sonar User and Privileges

Create a user named sonar and make it the owner of the /opt/sonarqubedirectory

Continuation configure SonarQube

Create a file /etc/systemd/system/sonarqube.service and past the following content on to the file

Start and enable sonarqube

To check if the service is running, run:


Now connect to the second machine

(SonarDB) under our admin

Installing the Database

Install the PostgreSQL repository.

Install the PostgreSQL database server by running:

Start PostgreSQL server and enable it to start automatically at boot time by running:

Change the password for the default PostgreSQL user

Switch to the postgres user.

Switch to the PostgreSQL shell.

Configure PostgreSQL

Set a password for the newly created user for SonarQube database.

Exit from the psql shell:

Move Databases PostgreSQL

Stop PostgreSQL service

Change data directory.

Change check

And also need to check system parameters. They can be added to the /etc/sysctl.conf file or entered in the terminal:

To check the availability of the database, connect to and type:

That’s all. To make sure that everything works, go to the browser (make sure that the 192.168.X.X network is accessible from yours or use links).

We’ll dial and you should be greeted with an authorization window.

Login: admin

Password: admin

This is the default admin account.