> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-server/server-installation/from-zip-file/starting-stopping-server/running-as-a-service.md).

# Running as a service

How to install and start SonarQube Server 2026.5 as a service in case of a ZIP installation. The operation depends on your operating system.

{% hint style="warning" %}
Installing SonarQube Server from the ZIP file is deprecated. It's still supported, but support will be removed in a future release, so consider the [Docker image](https://hub.docker.com/_/sonarqube) or the [Helm chart](https://artifacthub.io/packages/helm/sonarqube/sonarqube) instead. See the [deprecation policy](/sonarqube-server/server-update-and-maintenance/maintenance/deprecations/deprecation-policy.md) for details. To move an existing ZIP installation, see the [ZIP installation migration guide](/sonarqube-server/server-update-and-maintenance/maintenance/zip-migration-guide.md).

The agentic features run as containers, so they have no ZIP equivalent. You can keep SonarQube Server on the ZIP file and deploy their containers alongside it. See [Deploying AI agents](/sonarqube-server/server-installation/ai-agents.md).
{% endhint %}

## On Windows <a href="#on-windows" id="on-windows"></a>

### Installing or uninstalling SonarQube as a service <a href="#installing-or-uninstalling-sonarqube-as-a-service" id="installing-or-uninstalling-sonarqube-as-a-service"></a>

```css-79elbk
> <sonarqubeHome>\bin\windows-x86-64\SonarService.bat install
> <sonarqubeHome>\bin\windows-x86-64\SonarService.bat uninstall
```

### Starting the service <a href="#starting-the-service" id="starting-the-service"></a>

```css-79elbk
> <sonarqubeHome>\bin\windows-x86-64\SonarService.bat start
```

{% hint style="info" %}
By default, the service will use the Java executable available on the Windows PATH. This setting can be changed by setting the environmental variable `SONAR_JAVA_PATH`. See more in [Advanced setup](/sonarqube-server/server-installation/from-zip-file/advanced-setup.md).
{% endhint %}

### Stopping the service <a href="#stopping-the-service" id="stopping-the-service"></a>

```css-79elbk
> <sonarqubeHome>\bin\windows-x86-64\SonarService.bat stop
```

{% hint style="info" %}
This command does a graceful shutdown where no new analysis report processing can start, but the tasks in progress are allowed to finish. The time a stop will take depends on the processing time of the tasks in progress. You’ll need to end all SonarQube Server processes manually to force a stop.
{% endhint %}

### Checking the service status <a href="#checking-the-service-status" id="checking-the-service-status"></a>

To check if the SonarQube service is running:

```css-79elbk
> <sonarqubeHome>\bin\windows-x86-64\SonarService.bat status
```

## On Linux with systemd <a href="#on-linux-with-systemd" id="on-linux-with-systemd"></a>

On a Unix system using systemd, you can install SonarQube as a service. You cannot run SonarQube as root in Unix systems. Ideally, you will have created a new account dedicated to the purpose of running SonarQube. Let’s suppose:

* The user used to start the service is `sonarqube`
* The group used to start the service is `sonarqube`
* The Java Virtual Machine is installed in `/opt/java/`
* SonarQube has been unzipped into `/opt/sonarqube/`

Then create the file `/etc/systemd/system/sonarqube.service` *based on* the following:

```css-79elbk
[Unit]
Description=SonarQube service
After=syslog.target network.target

[Service]
Type=simple
User=sonarqube
Group=sonarqube
PermissionsStartOnly=true
ExecStart=/bin/nohup /opt/java/bin/java -Djava.net.preferIPv4Stack=true -jar /opt/sonarqube/lib/sonar-application-2026.1.0.119033.jar
StandardOutput=journal
LimitNOFILE=131072
LimitNPROC=8192
TimeoutStartSec=5
Restart=always
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target
```

{% hint style="info" %}

* Because the sonar-application jar name ends with the version of SonarQube, you will need to adjust the `ExecStart` command accordingly on install and at each upgrade.
* All SonarQube directories should be owned by the `sonarqube` user.
* If you have multiple Java versions, you will need to modify the `java` path in the `ExecStart` command. This also means `SONAR_JAVA_PATH` will not work with SonarQube as a service.
  {% endhint %}

Once your `sonarqube.service` file is created and properly configured, run:

```css-79elbk
sudo systemctl enable sonarqube.service
sudo systemctl start sonarqube.service
```

## On Linux with initd <a href="#on-linux-with-initd" id="on-linux-with-initd"></a>

The following has been tested on Ubuntu 20.04 and CentOS 6.2.

You cannot run SonarQube as `root` in \*nix systems. Ideally, you will have created a new account dedicated to the purpose of running SonarQube. Let’s suppose the user used to start the service is `sonarqube`. Then create the file`/etc/init.d/sonar` *based on* the following:

```css-79elbk
#!/bin/sh
#
# rc file for SonarQube
#
# chkconfig: 345 96 10
# description: SonarQube system (www.sonarsource.org)
#
## BEGIN INIT INFO
# Provides: sonar
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: SonarQube system (www.sonarsource.org)
# Description: SonarQube system (www.sonarsource.org)
## END INIT INFO
 
su sonarqube -c "/usr/bin/sonar $*"
```

Register SonarQube at boot time (RedHat, CentOS, 64 bit):

```css-79elbk
sudo ln -s <sonarqubeHome>/bin/linux-x86-64/sonar.sh /usr/bin/sonar
sudo chmod 755 /etc/init.d/sonar
sudo chkconfig --add sonar
```

Register SonarQube at boot time (Ubuntu, 64 bit):

```css-79elbk
sudo ln -s <sonarqubeHome>/bin/linux-x86-64/sonar.sh /usr/bin/sonar
sudo chmod 755 /etc/init.d/sonar
sudo update-rc.d sonar defaults
```

Once registration is done, run:

```css-79elbk
sudo service sonar start
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-server/server-installation/from-zip-file/starting-stopping-server/running-as-a-service.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
