Sonarqube server installation

Is it possible to install the sonaqube server under linux while making the necessary settings including sonar-scanner and access the server from a windows system?
If this is possible then how to do this, please?

Hey there.

No matter where a SonarQube server is hosted, a scanner on any machine (mac, windows, linux) can target the server.

1 Like

hello, thank you

Installing WSL is now easier than ever. Search for Windows PowerShell in your Windows search bar, then select Run as administrator.
At the command prompt type:

install wsl

wsl --install

Install Ubuntu on WSL2 on Windows 10

There is a single command that will install both WSL and Ubuntu at the same time.
When opening PowerShell for the first time, simply modify the initial instruction to:

wsl --install -d ubuntu

This will install both WSL and Ubuntu! Don’t forget to restart your machine before continuing.

search for Ubuntu in your Windows search bar

Configure Ubuntu

Finally, it’s always good practice to install the latest updates with the following commands, entering your password when prompted.

sudo apt update


sudo apt upgrade

How to Use SonarQube on Ubuntu 22.04 LTS

1. Configure Firewall

SonarQube web tool needs HTTP and HTTPS ports to work.
Open them using the Uncomplicated Firewall (UFW).

sudo ufw allow http

sudo ufw allow https

Check the firewall status.

sudo ufw status

2. Install OpenJDK

sudo apt install openjdk-11-jdk

3. Install PostgreSQL

Check the status of the PostgreSQL service.

Configure PostgreSQL

Log in to the PostgreSQL shell.

sudo -u postgres psql

Create the sonar role.

postgres=# CREATE ROLE sonar WITH LOGIN ENCRYPTED PASSWORD 'your_password';

Create the sonarqube database.
postgres=# CREATE DATABASE sonarqube;

Grant all privileges on the sonarqube database to the sonar role.
postgres=# GRANT ALL PRIVILEGES ON DATABASE sonarqube to sonar;

Exit the shell.
postgres=# \q

Return to your default user account.

5. Install Sonarqube

Copy the URL of the latest version of the community edition from the SonarQube downloads page.


Unzip the downloaded archive.

unzip -q

Move the files to the /opt/sonarqube directory.
sudo mv /opt/sonarqube

Delete the downloaded archive.

6. Create SonarQube User

Create a system user along with the group for SonarQube.
sudo adduser --system --no-create-home --group --disabled-login sonarqube

Give Sonar user permissions to the /opt/sonarqube directory.

sudo chown sonarqube:sonarqube /opt/sonarqube -R

7. Configure SonarQube Server
Open the SonarQube configuration file for editing.
sudo nano /opt/sonarqube/conf/

Find the following lines.



Uncomment them by removing the hash in front of them and adding the database credentials created in step 4.


sonar.jdbc.password= your_password

Find the following line.

replace the existing value with the following.


Increase the virtual memory on the system for Elasticsearch to function. Open the sysctl.conf file for editing.

sudo nano /etc/sysctl.conf

Paste the following lines at the end of the file.



Create the file /etc/security/limits.d/99-sonarqube.conf and open it for editing.

sudo nano /etc/security/limits.d/99-sonarqube.conf

Paste the following lines to increase the file descriptors and threads that the sonarqube user can open.

sonarqube   -   nofile   131072

sonarqube   -   nproc    8192

Reboot the system to apply the changes.

sudo reboot

8. Setup Sonar Service

Create the systemd service file for Sonar and open it for editing.

sudo nano /etc/systemd/system/sonarqube.service

Paste the following code in it.


Description=SonarQube service



ExecStart=/opt/sonarqube/bin/linux-x86-64/ start

ExecStop=/opt/sonarqube/bin/linux-x86-64/ stop











Save the file by pressing CTRL+X, then Y.

Start the SonarQube service.
sudo systemctl start sonarqube

Check the status of the service.

sudo systemctl status sonarqube

Enable the service to start automatically at boot.

sudo systemctl enable sonarqube

13. Install SonarQube’s Code Scanner

SonarQube provides various scanners depending on the programming language. Install the Command line version of the Sonarscanner.

Download the scanner.


Extract the archive.

sudo unzip
Move the directory to /opt/sonarscanner.

sudo mv /opt/sonarscanner

start sonarque server under linux and you can access it from windows


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.