How to set up a TeamSpeak Linux server

Need a reliable, private VPS server for TeamSpeak on Linux? Sign up for BitLaunch here. New customers can request a free trial!

Though Discord has become the popular choice for voice chat for gamers, TeamSpeak has been around for longer and is sill utilized by many. Discord may be feature rich, but the TeamSpeak VoIP software uses a propriety protocol that requires fewer resources. Ultimately, that translates to better performance in whatever title you're playing.

However, though a new TeamSpeak client that includes its own free servers is in beta, currently users must self-host TeamSpeak 3 on a VPS or other hosting. Today, we're going to walk you through TeamSpeak Linux server setup on Ubuntu 20.04. For a Windows install, you can see our previous guide.

How to set up a Teamspeak 3 server on Linux

For this tutorial, you'll need a local Windows or Linux machine, an Ubuntu 20.04 VPS server, and a method to connect to that server, such as PuTTy.

Step 1 – Create a new TeamSpeak user

Once you're connected, the first step is to update your server to ensure it has the latest security packages:

sudo apt-get update && sudo apt-get -y upgrade

It's then a good practice to create a new user specifically for our Teamspeak server. This will ensure it doesn't have more privillages than it needs to and is seperated from the rest of the OS:

sudo adduser --disabled-login teamspeak

The --disabled-login option makes it so the user isn't able to login, instead becoming accessible only through our root user. Enter the relevant information and press y when asked Is the information correct [Y/n]?.

Run cd /home/teamspeak/;su teamspeak.

Step 2 – Download  and Extract TeamSpeak server packages

Now we can download the latest version of TeamSpeak server from the official website. Note that the URL below links to the latest version at the time of writing, but it may not by the time you read this. Check the site to make sure it is. You'll have to modify the commands below to match your file name if it's different.

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

Let's extract the files and remove any old ones.

tar xvfj teamspeak3-server_linux_amd64-3.13.1.tar.bz2
cd teamspeak3-server_linux_amd64
cp * -R /home/teamspeak
cd ..
rm -r teamspeak3-server_linux_amd64
rm teamspeak3-server_linux_amd64-3.12.1.tar.bz2

Step 3 – Accept the license agreement

Before we can run TeamSpeak, we need to create a file indicating that we accept the license agreement. To do so, type:

touch .ts3server_license_accepted

Though this file is empty, it's enough to indicate that we accept the terms of the software use.

Step 4 – Retrieve your privileged key

When connecting to a TeamSpeak 3 server for the first time, you'll need a privileged key to verify that you are indeed the owner. You can retrieve this by starting your server via the provided script:

./ts3server_startscript.sh start

On first boot, you'll get an output like this:

------------------------------------------------------------------
                      I M P O R T A N T                           
------------------------------------------------------------------
               Server Query Admin Account created                 
         loginname= "serveradmin", password= "Y15pbQv0"
         apikey= "BACCgVsVx9C2bxrmFjjGgUU9jQXhH6wmVre1TI_"
------------------------------------------------------------------


------------------------------------------------------------------
                      I M P O R T A N T                           
------------------------------------------------------------------
      ServerAdmin privilege key created, please use it to gain 
      serveradmin rights for your virtualserver. please
      also check the doc/privilegekey_guide.txt for details.

       token=5JzgJCw5gdPEPmEwAVjb0xHIPVmOrFx8NThBvHwh
------------------------------------------------------------------

Copy this information to a safe location, taking particular note of the privilege key token, as you'll need that in a bit.

Step 5 – Open the TeamSpeak firewall ports

By default, your server may not have the correct ports opened to allow TeamSpeak on Linux traffic in and out. To remedy this we can run the following commands:

sudo ufw allow 3033/tcp
sudo ufw allow 9987/udp
sudo ufw allow 1011/tcp

Step 6 – Create a startup script

Now that we've set up our TeamSpeak server on Linux, it's beneficial to create a script to make it start every time the VPS is booted. This can aid in resilience if there's any temporary downtime and get everything up and running automatically after an update.

There are various ways to make a program run on startup, but in this case systemctl makes the most sense. First, log back in on your root user with su and then enter your password. Now create a text file in /lib/systemd/system/teamspeak.service by typing nano /lib/systemd/system/teamspeak.service and pasting the following into the document:

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

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

[Install]
WantedBy=multi-user.target

Press Ctrl + O and Ctrl + X, then activate the service via:

systemctl enable teamspeak.service

Reboot your server ( reboot ), and type systemctl status teamspeak to make sure it's running. The output should look something like this:

 teamspeak.service - Teamspeak Service
     Loaded: loaded (/lib/systemd/system/teamspeak.service; enabled; vendor pre>
     Active: active (running) since Tue 2020-11-17 15:30:40 UTC; 2min 55s ago
   Main PID: 671 (ts3server)
      Tasks: 21 (limit: 614)
     Memory: 18.5M
     CGroup: /system.slice/teamspeak.service
             └─671 ./ts3server
 teamspeak.service - Teamspeak Service
     Loaded: loaded (/lib/systemd/system/teamspeak.service; enabled; vendor pre>
     Active: active (running) since Tue 2020-11-17 15:30:40 UTC; 2min 55s ago
   Main PID: 671 (ts3server)
      Tasks: 21 (limit: 614)
     Memory: 18.5M
     CGroup: /system.slice/teamspeak.service
             └─671 ./ts3server

Step 7 – Connect a TeamSpeak 3 client

On your local PC, download and install the TeamSpeak 3 client from the official webpage or your software center.

Enter your server IP address in the "Nickname or address" field, and give it a name.

Click Connect and enter the privileged key you copied earlier. Press OK to connect to the server.