Skip to content

TeamSpeak 3 Server — Upgrade Script

This script upgrades an existing TeamSpeak 3 server installation to a new version. It stops the service, backs up the current installation, extracts the new release, and restarts.

For a fresh installation, see TeamSpeak 3 Server — Install on Ubuntu.


Before You Start — Know Your Setup

The script has two variables at the top that must match your installation. Find them before editing the script.

TSPATH — the directory where the TS3 server files live. Find it with:

find /home /opt -name "ts3server" -type f 2>/dev/null

The directory containing that binary is your TSPATH.

BACKUPPATH — where backups will be stored before each upgrade. The script creates this directory automatically if it does not exist. Recommended: a backups/ subfolder inside TSPATH.


Dependencies

The script requires these packages on the server:

Package Purpose Pre-installed on Ubuntu
wget Downloads the release archive Usually yes
bzip2 Decompresses the .tar.bz2 archive No
tar Extracts the archive Yes
systemctl Stops and starts the service Yes (systemd)

Install any missing packages before running the script:

apt install -y wget bzip2

The Script

Save as upgrade-ts3.sh, then set the two variables at the top to match your installation:

#!/usr/bin/env bash
set -euo pipefail

# Adapt these two values to your installation
TSPATH=/opt/teamspeak
BACKUPPATH=/opt/teamspeak/backups

if [ -z "${1:-}" ]; then
  echo "Usage: $0 <version>  e.g. $0 3.13.8"
  exit 1
elif [[ $1 =~ ^[[:digit:]]{1,2}\.[[:digit:]]{1,2}\.[[:digit:]]{1,2}$ ]]; then
  echo "Starting upgrade to $1..."

  wget -O /tmp/ts3server.tar.bz2 \
    "https://files.teamspeak-services.com/releases/server/$1/teamspeak3-server_linux_amd64-$1.tar.bz2"

  mkdir -p "$BACKUPPATH"

  systemctl stop teamspeak.service || true
  pkill -x ts3server || true
  sleep 2

  tar -czvf "$BACKUPPATH/ts3_backup_before_$1.tar.gz" \
    --exclude="$BACKUPPATH" \
    "$TSPATH"

  tar -xjf /tmp/ts3server.tar.bz2 \
    -C "$TSPATH/" \
    --strip-components=1

  chown -R teamspeak:teamspeak "$TSPATH"

  systemctl start teamspeak.service
  rm -f /tmp/ts3server.tar.bz2

  echo "Upgrade to $1 complete."
  systemctl status teamspeak.service
else
  echo "Invalid version number: $1"
  exit 1
fi

Run it:

bash upgrade-ts3.sh 3.13.8

What the Script Does

  1. Downloads the release archive from the official TeamSpeak CDN
  2. Creates BACKUPPATH if it does not exist
  3. Stops the service — both via systemd and via pkill to catch any instance not managed by systemd
  4. Creates a timestamped backup of TSPATH, excluding BACKUPPATH itself to avoid a recursive archive
  5. Extracts the new release directly into TSPATH with --strip-components=1
  6. Restores file ownership and starts the service

Verify After Upgrade

journalctl -u teamspeak.service -n 20 | grep "TeamSpeak 3 Server"

The output shows the version number and build date of the running binary.


Known Pitfalls

Problem Cause Fix
bzip2: Cannot exec: No such file or directory bzip2 not installed apt install -y bzip2
Cannot open: No such file or directory on backup BACKUPPATH does not exist Script now creates it automatically with mkdir -p
Version unchanged after upgrade Backup tar exited non-zero — set -e aborted before extract ran Ensure --exclude="$BACKUPPATH" is in the backup command
Address already in use after restart Old ts3server process still running, not managed by systemd Script runs pkill -x ts3server \|\| true before starting
Service fails with 203/EXEC Wrong binary path in service file Binary is ts3server, not ts3server_linux_amd64