Run Confluence as a systemd service on linux

Still need help?

The Atlassian Community is here for you.

Ask the community

For Atlassian eyes only

This article is Not Validated and cannot be shared with customers.

Purpose

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:

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

      (info) 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 

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

      [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

      (info) 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. 

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

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

      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

      systemctl daemon-reload
      systemctl enable confluence.service
      systemctl start confluence.service
      systemctl stop confluence.service
      systemctl status confluence.service

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

Last modified on Sep 3, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.