Skip to main content

How to Self-Host a TeamSpeak Server

Table of Contents

This article summarises my experiences in self-hosting a TeamSpeak Server.

# Preparation

First, choose a suitable VPS provider. Since voice chat is hightly sensitive to latency, it is better to select a provider with servers geographically close to your location and your users. A latency under 100 ms is ideal.

After deploying your VPS, it is crucial to harden its security. You can refer to my previous article for detailed steps.

# Create a New User

Create a dedicated user for the TeamSpeak server.

sudo adduser teamspeak

You can also append the --disabled-login flag after adduser. This option prevents direct logins with this user, requiring you to switch to it from root.

Switch to teamspeak for the following steps.

su teamspeak

# Download TeamSpeak Server

Vist the Official downloads page to find the URL for the latest Linux server version.

Use wget to download the package. For example:

wget https://files.teamspeak-services.com/releases/server/3.13.7/teamspeak3-server_linux_amd64-3.13.7.tar.bz2

Then, extract the archive.

tar xvfj teamspeak3-server_linux_amd64-3.13.7.tar.bz2

# Accept the License and Initial Start

Before running TeamSpeak, we must create a specific file to accept the license agreement.

touch .ts3server_license_accepted

On the first run, you need to generate a privilege key. This key is used to grant administrator premissions on your new server.

./ts3server_startscript.sh start

When finished, copy the entire output and save it securely. The token shown on the final line is your privilege key.

# Firewall Configuration

Next, you need to open the 9987, 10011, and 30033 ports in your firewall. We use firewalld as an example.

sudo firewalld --permanent --add-port=9987/udp
sudo firewalld --permanent --add-port=10011/tcp
sudo firewalld --permanent --add-port=30033/tcp
sudo firewalld --reload

# Connect to Your Server

Download the TeamSpeak Client from the official website. Although you are running a TeamSpeak 3 server, you can connect to it using the modern TeamSpeak 6 client.

Use your VPS IP address to log into the server. When prompted, enter the privilege key that you saved earlier to gain administrator access of the server.

# [Option] Create a startup script

To ensure the TeamSpeak server starts automatically on boot and restarts if it crashes, it is good to set it up as a systemd service.

Switch back to root and create a service file.

su root
vim /lib/systemd/system/teamspeak.service

Copy and paste the following content and modify [Your PATH] to the TeamSpeak installed path.

[Unit]
Description=Teamspeak Server Service
Wants=network.target

[Service]
WorkingDirectory=[Your PATH]
User=teamspeak
ExecStart=[Your PATH]/ts3server_minimal_runscript.sh
ExecStop=[Your PATH]/ts3server_startscript.sh stop
ExecReload=[Your PATH]/ts3server_startscript.sh restart
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target

Then, enable and start the service.

systemctl enable teamspeak.service
systemctl start teamspeak.service

# [Option] Connect by Using a Domain

Connecting via an IP address can be inconvenient. If you own a domain name, you can configure it by the following steps. For this example, I will use Cloudflare with ts.example.com as the domain name.

  1. A Record:

    • Type: A
    • Name: ts
    • Content: [Your VPS IP address]
  2. SRV Record:

    • Type: SRV
    • Name: _ts3._udp.ts
    • Priority: 0
    • Weight: 5
    • Port: 9987
    • Target: ts.example.com