Step-by-Step Guide to Set Up Jira Software on Ubuntu Using a Bash Script


Intro
Jira is one of the most popular project management and issue-tracking tools used by agile teams worldwide.
But setting it up manually can be time-consuming, especially when you need to configure Java, PostgreSQL, and Jira’s system services.
In this guide, I’ll show you how to automate Jira installation on Ubuntu using a single Bash script. By the end, you’ll have Jira running as a systemd service, ready to access from your browser.
Steps Overview
Here’s what our script does:
Updates the system.
Installs dependencies (
Java
,PostgreSQL
,wget
,curl
).Creates a dedicated
jira
service user.Downloads and installs Jira Software.
Configures Jira Home directory.
Sets up PostgreSQL database + driver.
Creates a
systemd
service for Jira.Starts Jira and makes it available at http://localhost:8080.
The Script
#!/bin/bash
# Set variables
JIRA_VERSION="9.16.1"
JIRA_INSTALL_DIR="/opt/atlassian/jira"
JIRA_HOME_DIR="/var/atlassian/application-data/jira"
DB_NAME="jiradb"
DB_USER="jirauser"
DB_PASS="StrongPassword"
# Update system
echo "Updating system..."
apt update -y && apt upgrade -y
# Install dependencies
echo "Installing required packages..."
apt install -y openjdk-11-jdk postgresql wget curl
# Add Jira user
echo "Creating Jira user..."
useradd --create-home --comment "Jira Service Account" --shell /bin/bash jira
echo "jira ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/jira
# Download and install Jira
echo "Downloading Jira Software..."
wget https://product-downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-${JIRA_VERSION}.tar.gz -P /tmp
echo "Extracting and installing Jira..."
mkdir -p ${JIRA_INSTALL_DIR}
tar -xzf /tmp/atlassian-jira-software-${JIRA_VERSION}.tar.gz -C ${JIRA_INSTALL_DIR} --strip-components=1
chown -R jira:jira ${JIRA_INSTALL_DIR}
# Set up Jira Home directory
echo "Configuring Jira home directory..."
mkdir -p ${JIRA_HOME_DIR}
chown -R jira:jira ${JIRA_HOME_DIR}
echo "jira.home=${JIRA_HOME_DIR}" > ${JIRA_INSTALL_DIR}/atlassian-jira/WEB-INF/classes/jira-application.properties
# Configure PostgreSQL
echo "Setting up PostgreSQL database..."
sudo -u postgres psql <<EOF
CREATE DATABASE ${DB_NAME} WITH ENCODING 'UTF8' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0;
CREATE USER ${DB_USER} WITH PASSWORD '${DB_PASS}';
GRANT ALL PRIVILEGES ON DATABASE ${DB_NAME} TO ${DB_USER};
ALTER DATABASE ${DB_NAME} OWNER TO ${DB_USER};
EOF
# Install PostgreSQL driver
echo "Installing PostgreSQL driver..."
wget -O ${JIRA_INSTALL_DIR}/lib/postgresql-42.2.27.jar https://jdbc.postgresql.org/download/postgresql-42.2.27.jar
chown jira:jira ${JIRA_INSTALL_DIR}/lib/postgresql-42.2.27.jar
# Create a systemd service file for Jira
echo "Creating Jira systemd service..."
cat <<EOF | tee /etc/systemd/system/jira.service
[Unit]
Description=Atlassian Jira Software
After=network.target
[Service]
Type=forking
User=jira
PIDFile=${JIRA_INSTALL_DIR}/work/catalina.pid
ExecStart=${JIRA_INSTALL_DIR}/bin/start-jira.sh
ExecStop=${JIRA_INSTALL_DIR}/bin/stop-jira.sh
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
EOF
# Reload systemd, enable and start Jira
echo "Starting Jira service..."
systemctl daemon-reload
systemctl enable jira
systemctl start jira
echo "Jira installation complete! Access it at: http://localhost:8080"
Verify Installation
After the script finishes, Jira should be running. You can check with:
systemctl status jira
Then open:
http://localhost:8080
If you’re using a remote server, you can expose it via ngrok or configure Nginx as a reverse proxy.
🔑 Jira License Key Setup
Once Jira is installed and running, you’ll be asked to enter a license key before continuing with the setup. This key is required to activate Jira Software and unlock its features.
You have two options at this stage:
Enter an existing license key
If your organization already has a Jira Software license, you can copy-paste it into the input box.
Jira validates the key against the server ID shown on the page.
Generate a trial license
If you don’t have a license yet, click the link “generate a Jira trial license at MyAtlassian”.
You’ll be redirected to Atlassian’s site, where you need to log in (or create an account).
Atlassian will generate a trial license for the specific Server ID (in this example:
B2FD-HZO9-UP4D-EZ59
).Copy the generated key and paste it back into the Jira setup form.
👉 This step ensures that only authorized users can run Jira Software, whether it’s under a commercial license or a free evaluation license.
Subscribe to my newsletter
Read articles from Parmod Upadhyay directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Parmod Upadhyay
Parmod Upadhyay
Experienced DevOps engineer and system administrator with expertise in SSL certificates, Linux, cloud security, Git, DNS, and automation. Skilled in managing VPS, Cloud, and Dedicated servers, deploying enterprise applications, and optimizing IT infrastructure. Passionate about cybersecurity, networking, and server monitoring with tools like Nagios and Zabbix. Strong knowledge of AWS, Ansible, Jenkins, and database management (MySQL, PostgreSQL, MSSQL). Dedicated to sharing insights on automation, DevOps best practices, and securing web applications.