# How to Install SonarQube Code Quality Analyzer on Rocky Linux 10

> URL: https://www.atlantic.net/dedicated-server-hosting/how-to-install-sonarqube-code-quality-analyzer-on-rocky-linux-10/ | Published: 2021-12-28 | Updated: 2025-10-19 | Author: Hitesh Jethva

SonarQube is an open-source code quality checking platform developed by SonarSource. It detects bugs and vulnerabilities in your code automatically and provides reports for the code quality of your project. It can analyze code in 27 different programming languages including C, C++, Java, Javascript, PHP, Go, Python, and many more. SonarQube helps developers to reduce the code size, complexity, and maintenance time and make it easier to read and understand.

In this post, we will show you how to install SonarQube on Rocky Linux10

## Step 1 – Getting Started

First, you will need to tweak the kernel settings per SonarQube requirements. You can do it editing /etc/sysctl.conf file.

```
nano /etc/sysctl.conf
```

Add the following lines:

```
vm.max_map_count=262144
fs.file-max=65536
```

Save and close the file, then run the following command to apply the changes:

```
sysctl -f
```

Next, install Java JDK using the following command:

```
dnf install java-21-openjdk-devel unzip -y
```

After the installation, verify the Java version using the command given below:

```
java --version
```

You should see the following output:

```
openjdk 21.0.8 2025-07-15 LTS
OpenJDK Runtime Environment (Red_Hat-21.0.8.0.9-1) (build 21.0.8+9-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-21.0.8.0.9-1) (build 21.0.8+9-LTS, mixed mode, sharing)
```

## Step 2 – Install and Configure PostgreSQL

SonarQube uses PostgreSQL as a database backend, so you will need to install a PostgreSQL database on your server.

First, install the PostgreSQL repo using the following command:

```
dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
```

Next, install the latest version of PostgreSQL with the following command:

```
dnf install postgresql18 postgresql18-server -y
```

Once the installation is completed, initialize the PostgreSQL database using the following command:

```
/usr/pgsql-18/bin/postgresql-18-setup initdb
```

Next, start and enable the PostgreSQL service with the following command:

```
systemctl enable --now postgresql-18
```

Next, log in to PostgreSQL with the following command:

```
su - postgres
psql
```

Next, create a database and user for SonarQube using the following command:

```
create user sonar;
create database sonardb owner sonar;
```

Next, grant all the privileges to the SonarQube database and set the user password:

```
grant all privileges on database sonardb to sonar;
ALTER USER sonar WITH ENCRYPTED password 'securepassword';
```

Next, exit from PostgreSQL using the following command:

```
\q
exit
```

## Step 3 – Install and Configure SonarQube

First, create a dedicated user for SonarQube using the following command:

```
useradd sonar
```

Next, download the latest version of SonarQube with the following command:

```
wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-25.10.0.114319.zip
```

After the successful download, unzip the downloaded file using the following command:

```
unzip sonarqube-25.10.0.114319.zip
```

Next, move the extracted directory to /opt with the following command:

```
mv sonarqube-25.10.0.114319 /opt/sonarqube
```

Next, edit the SonarQube configuration file:

```
nano /opt/sonarqube/conf/sonar.properties
```

Define your SonarQube database, web host, JVM option, and data directory:

```
sonar.jdbc.username=sonar
sonar.jdbc.password=securepassword
sonar.jdbc.url=jdbc:postgresql://localhost/sonardb

sonar.web.host=0.0.0.0
sonar.web.port=9000

sonar.web.javaOpts=-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError
sonar.search.javaOpts=-Xmx512m -Xms512m -XX:MaxDirectMemorySize=256m -XX:+HeapDumpOnOutOfMemoryError

sonar.path.data=data
sonar.path.temp=temp
```

Save and close the file, then change the ownership of the /opt/sonarqube:

```
chown -R sonar:sonar /opt/sonarqube
```

## Step 4 – Create a Systemd Service File for SonarQube

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

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

Add the following lines:

```
[Unit]
Description=SonarQube service
After=syslog.target network.target

[Service]
Type=forking
ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start
ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop
LimitNOFILE=65536
LimitNPROC=4096
User=sonar
Group=sonar
Restart=on-failure

[Install]
WantedBy=multi-user.target
```

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
```

Next, verify the SonarQube service status using the command given below:

```
systemctl status sonarqube
```

You should see the following output:

```
● sonarqube.service - SonarQube service
     Loaded: loaded (/etc/systemd/system/sonarqube.service; disabled; preset: disabled)
     Active: active (running) since Sun 2025-10-19 01:04:14 EDT; 4s ago
 Invocation: a173ea340b99480faca86052ddcc7f45
    Process: 10735 ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start (code=exited, status=0/SUCCESS)
   Main PID: 10759 (java)
      Tasks: 48 (limit: 24809)
     Memory: 457.4M (peak: 743.2M)
        CPU: 7.584s
     CGroup: /system.slice/sonarqube.service
             ├─10759 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=ALL-UNNAMED -->
             ├─10784 /usr/lib/jvm/java-21-openjdk/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=./bin/elasticsearch -Dcli.libs=lib/tools/server-cli -Des.path>
             └─10843 /usr/lib/jvm/java-21-openjdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -Djava.security.manager=allow -XX:+AlwaysPreTouch>

Oct 19 01:04:14 rocky systemd[1]: Starting sonarqube.service - SonarQube service...
Oct 19 01:04:14 rocky sonar.sh[10735]: /usr/bin/java
Oct 19 01:04:14 rocky sonar.sh[10735]: Starting SonarQube...
Oct 19 01:04:14 rocky sonar.sh[10735]: Started SonarQube.
Oct 19 01:04:14 rocky systemd[1]: Started sonarqube.service - SonarQube service.
```

At this point, SonarQube is started and listens on port 9000. You can check it using the following command:

```
ss -antpl | grep 9000
```

You should see the following output:

```
LISTEN 0      25                      *:9000             *:*    users:(("java",pid=6541,fd=13))
```

## Step 5 – Access SonarQube Web Interface

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:
 ![](https://www.atlantic.net/wp-content/uploads/2021/12/s1.png)
 Provide default admin username and password as admin/admin and click on the **Log in** button. Once you are logged in, you should see the password update page:

![](https://www.atlantic.net/wp-content/uploads/2021/12/s2.png)
 Change the default admin password and click on the **Update** button. You should see the SonarQube dashboard on the following page:

![](https://www.atlantic.net/wp-content/uploads/2021/12/s3.png)

## Conclusion

Congratulations! You have successfully installed SonarQube on Rocky Linux 10. You can now create your project manually or import from GitHub, GitLab, or Azure and start analyzing your code from the web browser. Try it on [dedicated hosting](https://www.atlantic.net/dedicated-server-hosting/) from Atlantic.Net!
