Run Jira Server or Data Center as a systemd service on linux

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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

Linux/Solaris system administration is outside the scope of Atlassian support. This page is provided for your information only.

Purpose

This article explains how to install Jira as a systemd service in Linux. 

Pre-requisites

Jira is installed and working but does not automatically start on boot. For example, Jira is installed via the .zip package rather than the .bin installer, or you have migrated JIRA to a different server.

Solution

    1. Login to the Jira application server as the root user.
    2. Create the following systemd unit file for the JIRA service as root:

      touch /lib/systemd/system/jira.service
      chmod 664 /lib/systemd/system/jira.service
    3. Edit the systemd unit file as root:

      vi /lib/systemd/system/jira.service
    4. Add the following content into the systemd unit file to define the JIRA service:

      [Unit] 
      Description=Atlassian Jira
      After=network.target
      
      [Service] 
      Type=forking
      User=jira
      LimitNOFILE=20000
      PIDFile=/opt/atlassian/jira/work/catalina.pid
      ExecStart=/opt/atlassian/jira/bin/start-jira.sh
      ExecStop=/opt/atlassian/jira/bin/stop-jira.sh
      
      [Install] 
      WantedBy=multi-user.target 

      (info) The above defined 'jira' user would be the user that is used to run JIRA, change this if you are running JIRA under a different user.

      (info) '/opt/atlassian/jira' would be the default Jira installation path, change this if your Jira installation path is different.
      (warning) Do not run Jira in the foreground, as this will prevent the file 'catalina.out' from being created. 


      Commands to run the scripts in the selinux context

      chcon -t bin_t install/bin/start-jira.sh
      chcon -t bin_t install/bin/stop-jira.sh

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

      ExecStart=/bin/bash /opt/atlassian/jira/bin/start-jira.sh
      ExecStop=/bin/bash /opt/atlassian/jira/bin/stop-jira.sh
    5. Enable the service and start it:

      systemctl daemon-reload
      systemctl enable jira.service
      systemctl start jira.service
      systemctl status jira.service

      (info) In some instances, you may see the following error message when attempting to enable the Jira service: 

      systemctl enable jira.service
      Synchronizing state of jira.service with SysV service script with /lib/systemd/systemd-sysv-install.
      Executing: /lib/systemd/systemd-sysv-install enable jira
      update-rc.d: error: jira Default-Start contains no runlevels, aborting.

      (info) This may be due to a previously created Jira service file. To resolve this, users may perform the following depending on their environment:

      Commands to run the scripts in the selinux context

      chcon -t bin_t install/bin/start-jira.sh
      chcon -t bin_t install/bin/stop-jira.sh

    6. If the file exists, backup up the previous Jira service file and then remove it before enabling the new Jira service file:

      cp /etc/init.d/jira /opt/atlassian/jira-init.d.bak && rm /etc/init.d/jira
      sudo systemctl enable jira.service
      Created symlink /etc/systemd/system/multi-user.target.wants/jira.service → /lib/systemd/system/jira.service.

      (warning) Furthermore, we recommend either disabling SELinux policies or thoroughly validating them.

Last modified on Oct 30, 2024

Was this helpful?

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