Atlantic.Net Blog

How to Install SonarQube on Arch Linux

SonarQube is an open-source and self-hosted code quality analysis tool used to check code in several programming languages via plugins. It allows development teams to find bugs and code duplication in a software application. It helps developers to decrease application size, code complexity, time, and cost of maintenance and makes code easier to read and understand. It is written in Java and supports several databases including Postgres, MySQL, Oracle, and SQL Server.

In this post, we will show you how to install SonarQube on Arch Linux.


  • A fresh Arch Linux server on the Atlantic.Net Cloud Platform
  • Minimum 4 GB of RAM
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Arch Linux as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Step 2 – Configure Repository

By default, the default repository is outdated in Arch Linux, so you will need to modify the default mirror list. You can do it by editing the mirror list configuration file:

nano  /etc/pacman.d/mirrorlist

Remove all lines and add the following lines:

## Score: 0.7, United States
Server =$repo/os/$arch
## Score: 0.8, United States
Server =$repo/os/$arch
Server =$repo/os/$arch
## Score: 0.9, United Kingdom
Server =$repo/os/$arch
## Score: 1.5, United Kingdom
Server =$repo/os/$arch
Server =$repo/os/$arch
## Score: 6.6, United States
Server =$repo/os/$arch
## Score: 6.7, United States
Server =$repo/os/$arch
## Score: 6.8, United States
Server =$repo/os/$arch
## Score: 7.1, India
Server =$repo/os/$arch
## Score: 10.1, United States
Server =$repo/os/$arch

Save and close the file, then update all the package indexes with the following command:

pacman -Syu

Step 3 – Install Java JDK

SonarQube is based on Java, so you will need to install Java on your server. You can install it with the following command.

pacman -S jdk17-openjdk unzip

Once Java is installed, you can verify it using the following command.

java --version

You will get the Java version information in the following output.

openjdk 17.0.6 2023-01-17
OpenJDK Runtime Environment (build 17.0.6+10)
OpenJDK 64-Bit Server VM (build 17.0.6+10, mixed mode)

Step 4 – Install and Configure PostgreSQL

First, install the PostgreSQL server with the following command.

pacman -S postgresql

Next, initialize the PostgreSQL database with the following command.

sudo -u postgres initdb --locale en_US.UTF-8 -D /var/lib/postgres/data

Next, start and enable the PostgreSQL service using the following command.

systemctl start postgresql
systemctl enable postgresql

Next, connect to the PostgreSQL shell.

sudo -u postgres psql

Next, create a database and user for SonarQube:

CREATE USER sonarqube WITH PASSWORD 'password';
CREATE DATABASE sonarqube OWNER sonarqube;

Next, exit from the PostgreSQL shell with the following command.


Step 5 – Download SonarQube

First, create a dedicated user to run SonarQube.

useradd -b /opt/sonarqube -s /bin/bash sonarqube

Next, download the latest version of SonarQube using the following command.


Once the download is completed, unzip the downloaded file with the following command.


Next, move the extracted directory to /opt using the following command.

mv sonarqube- /opt/sonarqube

Next, change the ownership of the SonarQube directory.

chown -R sonarqube:sonarqube /opt/sonarqube

Next, edit the SonarQube configuration file.

nano /opt/sonarqube/conf/

Change the following lines as per your settings.

sonar.web.javaOpts=-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError

Save and close the file when you are done.

Step 6 – Create a Systemd Service File for SonarQube

Next, you will need to create a systemd service file to manage the SonarQube service. You can create it with the following command.

nano /etc/systemd/system/sonarqube.service

Add the following configurations.

Description=SonarQube service

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


Save and close the file, then reload the systemd daemon to apply the changes.

systemctl daemon-reload

Next, start and enable the SonarQube service.

systemctl start sonarqube
systemctl enable sonarqube

You can check the status of SonarQube using the following command.

systemctl status sonarqube


● sonarqube.service - SonarQube service
     Loaded: loaded (/etc/systemd/system/sonarqube.service; disabled; preset: disabled)
     Active: active (running) since Sun 2023-03-26 04:42:04 UTC; 17s ago
    Process: 1008 ExecStart=/opt/sonarqube/bin/linux-x86-64/ start (code=exited, status=0/SUCCESS)
   Main PID: 1033 (java)
      Tasks: 119 (limit: 4685)
     Memory: 1.1G
        CPU: 33.270s
     CGroup: /system.slice/sonarqube.service
             ├─1033 java -Xms8m -Xmx32m --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio>
             ├─1058 /usr/lib/jvm/java-17-openjdk/bin/java -XX:+UseG1GC -XX:ErrorFile=/opt/sonarqube/logs/es_hs_err_pid%p.log -Des.>
             └─1168 /usr/lib/jvm/java-17-openjdk/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -XX:-OmitStackTraceInFast>

Mar 26 04:42:04 archlinux systemd[1]: Starting SonarQube service...
Mar 26 04:42:04 archlinux[1008]: /usr/bin/java
Mar 26 04:42:04 archlinux systemd[1]: Started SonarQube service.
Mar 26 04:42:04 archlinux[1008]: Starting SonarQube...
Mar 26 04:42:04 archlinux[1008]: Started SonarQube.

Step 7 – Access SonarQube Web UI

At this point, SonarQube is installed and running. Now, open your web browser and access the SonarQube web interface using the URL http://your-server-ip:9000. You should see the SonarQube login page:

Provide the default admin username and password as admin/admin then click on the Login button. You should see the password change screen.

Change your default password, then click on the Update button. You should see the SonarQube dashboard on the following screen.


In this post, we explained how to install SonarQube on Arch Linux. You can now create your first project manually or import it from the other DevOps platform. You can now try to deploy SonarQube on dedicated server hosting from Atlantic.Net!

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year