Skip to main content

Installing and Migrating TeamSpeak3

·5 mins

The time finally arrived to annihilate the old Crystal Docks TeamSpeak3 server, and rebuild it to make it harder better faster stronger. Below is all the bits and pieces related to rebuilding TeamSpeak3 on the new server.

This was created on a Ubuntu 18.04 LTS server, so if you’re using a different distribution then you might run into problems executing the commands below.

Backup #

It’s always a good idea to backup your stuff, especially when you’re going to be detonating servers. It’s also a smart move to test your backups, which you should totally do because I definitely did. When you back up TeamSpeak3, you should stop the service for the backup. I use the below rsync command. Adjust as you need.

rsync -azvAXH -e ssh teamspeak:/home/teamspeak/ /home/user/backup/

Migration Files #

If you need to migrate your TeamSpeak3 instance over to a new instance, there’s a few files which you’ll want to move over from your backup. Their knowledge base suggests migrating the below files.

  • licensekey.dat
  • query_ip_whitelist.txt
  • query_ip_blacklist.txt
  • files/*
  • ts3server.sqlitedb
  • *.ini
  • tsdns/tsdns_settings.ini

Installation and Configuration #

We’ll create a specific and unprivileged user account to run TeamSpeak3. You can call it what you like, but teamspeak seems pretty reasonable. Make sure to note the password, even though we won’t need to log in often. Worst case you can just reset it with your privileged account.

 sudo adduser teamspeak

Now we can switch over to the teamspeak user, create a teamspeak3-server-current directory (which will act as the operating TS3 directory), download, then extract TeamSpeak3. If you just copy and paste the below commands, you’ll get version 3.1.3 - It’s a good idea to get the latest stable version. Go to the TeamSpeak3 downloads page and check what the latest Linux Server 64-bit release is. You’ll need to copy the link as you’ll be downloading it with wget.

su teamspeak
cd ~
mkdir teamspeak3-server-current
tar xf teamspeak3-server_linux_amd64-3.1.3.tar.bz2 -C ./teamspeak3-server-current --strip-components 1
rm teamspeak3-server_linux_amd64-3.1.3.tar.bz2

Now you’ll want to move your backed up files over, if you have any. Make sure the owner and group of the migrated files are set to teamspeak, which would be sudo chown teamspeak:teamspeak /path/to/file. Remember to change files within directories too.

TS3 License #

You’ll probably need to accept the TeamSpeak3 license - if you’ve tried to run TeamSpeak3 without accepting the license, it won’t start up.

If you’ve migrated an existing server, you bypass accepting the license during the usual setup. We can notify TeamSpeak that we accept the license by creating a dot file and putting a variable in there.

vi /home/teamspeak/teamspeak3-server-current/.ts3server_license_accepted

With license_accepted=1 in it.

Now we’ll want to type and execute exit to exit out of our teamspeak user, and land back in our sudo enabled account.

Firewall #

We need to open some ports on our firewall to allow connections through. I’ll be using Uncomplicated Firewall, and we’ll need root permissions. If you’re not using UFW, then you’ll need to find your commands to allow port/protocol 9987/udp, 30033/tcp, 10011/tcp.

If you use TSDNS, you will also need to allow 41144/tcp.

sudo ufw allow 9987/udp
sudo ufw allow 30033/tcp
sudo ufw allow 10011/tcp

TeamSpeak3 Service - Start on Boot #

There’s two popular initialisation systems - the older systemV, and the newer systemd. These will allow you to create and manage the TeamSpeak3 service more easily, and also allow TeamSpeak3 to automatically start if your server reboots.

systemd #

Systemd calls it’s configuration files “Unit Files”, and we’ll be creating our Unit File in the /etc/systemd/system/ directory.

sudo vi /etc/systemd/system/teamspeak.service

Thanks to Schroeffu, who has a nice example and breakdown on a systemd Unit File for TeamSpeak3 which I’ve pilfered and modified ever so slightly.

Description=TeamSpeak3 Server Daemon

ExecStart=/home/teamspeak/teamspeak3-server-current/ start
ExecStop=/home/teamspeak/teamspeak3-server-current/ stop


Make sure our permissions are set correctly on our new file.

sudo chmod 644 /etc/systemd/system/teamspeak.service

Then we’ll tell systemd that our shiny new Unit File is a thing and it should totally check it out because it’s pretty sweet, and then we’ll start the teamspeak service.

 sudo systemctl daemon-reload
 sudo systemctl enable teamspeak.service
 sudo systemctl start teamspeak.service

Now we can control the teamspeak service with the below commands.

sudo systemctl start teamspeak.service
sudo systemctl stop teamspeak.service
sudo systemctl reload teamspeak.service
sudo systemctl status teamspeak.service

systemV #

SystemV calls it’s configuration files “Init Files”, and we’ll be creating our Init File in the /etc/init.d/ directory.

sudo vi /etc/init.d/teamspeak

Our Init File will have the below contents.

# Provides: teamspeak
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Start/Stop/Restart/Status for the TeamSpeak3 Server Daemon

###### Teamspeak 3 server start/stop script ######
case "$1" in
su $USER -c $DIR"/ start"
su $USER -c $DIR"/ stop"
su $USER -c $DIR"/ restart"
su $USER -c $DIR"/ status"
echo "Usage: " >&2
exit 1
exit 0

Make sure our permissions are set correctly on our new file.

sudo chmod 755 /etc/init.d/teamspeak

Now we’ll need to let the system know we’ve got a new service.

 sudo update-rc.d teamspeak defaults

Now we can control the teamspeak service with the below commands.

sudo service teamspeak start
sudo service teamspeak stop
sudo service teamspeak restart
sudo service teamspeak status