Run Confluence as a systemd service on linux

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

This article explains how to install Confluence as a systemd service in linux.

Pre-requisites

  1. You already have Confluence installed and working, but you need it to function as a service (i.e. start on boot).

  2. Your existing Confluence installation is running under a user other than root (we'll assume the user is named 'confluence').

Solution

    1. Login to the machine and elevate to the root user

    2. Create the following service config as root:

      1 2 touch /lib/systemd/system/confluence.service chmod 664 /lib/systemd/system/confluence.service

      ℹ️ Note: CentOS and RedHat linux versions can be configured to use /etc/systemd/system path as well to create this unit file.

    3. Edit the service config as root

      1 vi /lib/systemd/system/confluence.service
    4. Define the service config by putting this into confluence.service

      1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [Unit] Description=Confluence After=network.target [Service] Type=forking User=confluence PIDFile=/opt/atlassian/confluence/work/catalina.pid ExecStart=/opt/atlassian/confluence/bin/start-confluence.sh ExecStop=/opt/atlassian/confluence/bin/stop-confluence.sh TimeoutSec=200 LimitNOFILE=32768 LimitNPROC=4096 [Install] WantedBy=multi-user.target

      ℹ️ Note: The above defined 'confluence' in the User line is the user under which you need to run Confluence. The name of this user may vary in your environment.

      ℹ️ Note: Change <Confluence-Installation-Directory> with the full path for your installation folder (e.g. /opt/atlassian-confluence-6.2.1 )

      ℹ️ Note: When running SELinux in enforcing mode it may be necessary to pass the start/stop of Confluence to the bash shell, like such:

      1 2 ExecStart=/bin/bash /opt/atlassian/confluence/bin/start-confluence.sh ExecStop=/bin/bash /opt/atlassian/confluence/bin/stop-confluence.sh
    5. Enable and start the service as root

      1 2 3 4 5 systemctl daemon-reload systemctl enable confluence.service systemctl start confluence.service systemctl stop confluence.service systemctl status confluence.service

ℹ️ When running Confluence as a systemd service on linux the Application server working directory is displayed as "/" in the System Information page Confluence

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.