Detect bugs on your code by installing SonarQube on Debian 11

Hello, friends. In this post, you will learn how to install SonarQube on Debian 11.

According to the official documentation of SonarQube

SonarQube is an automatic code review tool to detect bugs, vulnerabilities, and code smells in your code. It can integrate with your existing workflow to enable continuous code inspection across your project branches and pull requests.

It allows teams to quickly analyze their code and improve product quality. It has many integrations and supports several programming languages.

So, you can guess why many teams prefer it for their projects.

Let’s go for it.

Install necessary packages

For this post, we are always going to use the root user. Before we start, we have to update the whole system.

So, once you are logged in to the server, run

apt update
apt install unzip software-properties-common wget default-jdk

This will install Java and other basic packages.

Installing PostgreSQL on Debian 11

The next step is to install PostgreSQL on the server. This is because SonarQube uses it as the data store.

With the version that we have available in the official repositories, it is enough for us.

apt install postgresql postgresql-contrib

Now we change to the postgres user to access the PostgreSQL console.

su - postgres

Now create a new user named sonarqube with a strong password and not like the one I have 🙂


Now create the database for SonarQube that belongs to the user.

CREATE DATABASE sonarqube OWNER sonarqube;

Assign permissions on the database.


And exit the console


Download SonarQube on Debian 11

As we are working with the root user, we have to create a folder where to store the download. For example:

mkdir -p /downloads/sonarqube

Inside it, download the latest version available.

cd /downloads/sonarqube
1.- Download SonarQube on Debian 11
1.- Download SonarQube on Debian 11

Now unzip the file


And the generated folder, you have to move it to another location like /opt.

mv sonarqube- /opt/sonarqube

Now create a new system user dedicated to SonarQube

adduser --system --no-create-home --group --disabled-login sonarqube

Make this user the owner of the folder

chown -R sonarqube:sonarqube /opt/sonarqube

Configure SonarQube before using it

In the initialization script of the application, we have to define who will run SonarQube. So open the file.

nano /opt/sonarqube/bin/linux-x86-64/

And find the line


And change it to this


Save the changes and close the editor.

Next, we have to edit another configuration file.

nano /opt/sonarqube/conf/

At the end of the file, you have to add the following


Save the changes and close the editor.

We also have to make some adjustments to the kernel.

nano /etc/sysctl.conf

In this file, you have to add the following lines


To apply the changes, you can reboot the system.


Log in to the SonarQube web interface

When rebooting, you can start running SonarQube again.

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

Then, open a web browser and go to your domain and add the port 9000 which has to be available on your firewall. For example, http://your-server:9000 and you will see the following after a while.

2.- SonarQube first screen
2.- SonarQube first screen

Now, you will be able to log in with username admin and password admin.

3.- Log in screen
3.- Log in screen

For security reasons, you will have to change the password immediately.

4.- Change the default password on SonarQube
4.- Change the default password on SonarQube

And then, you will see the main screen, and can start working with it.

5.- SonarQube on Debian 11
5.- SonarQube on Debian 11



In this post, you learned how to install SonarQube on Debian 11 and thus have an important tool for debugging your application code.

I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook