How to Install TeamSpeak Server on Debian 11
On this page
- Prerequisites
- Step 1 - Configure Firewall
- Step 2 - Download TeamSpeak
- Step 3 - Create TeamSpeak user and directory
- Step 4 - Run TeamSpeak server
- Step 5 - Creating TeamSpeak Service daemon
- Step 6 - Connect using TeamSpeak Client
- Step 7 - Changing Access Password
- Step 8 - Installing and configuring MySQL
- Step 9 - Upgrading TeamSpeak
- Conclusion
TeamSpeak is cross-platform voice chat software used by gamers, teams, and schools. It is lightweight and fast and offers you more control since you can host it on your server. It offers a secure and easy way to connect with people across the globe. It has a fully customizable user interface, supports direct messaging, unlimited file transfer, and allows anonymous usage.
This tutorial will teach you how to install the TeamSpeak server on a Debian 11 based server and connect to it using a Windows client.
Prerequisites
-
A Debian 11 based server.
-
A non-root user with sudo privileges.
-
Sudo package is installed.
-
Everything is updated.
$ sudo apt update && sudo apt upgrade
-
Few packages that your system needs.
$ sudo apt install nano ufw software-properties-common dirmngr apt-transport-https gnupg2 ca-certificates lsb-release debian-archive-keyring wget -y
Some of these packages may already be installed on your system.
Step 1 - Configure Firewall
The first step is to configure the firewall. Debian comes with ufw (Uncomplicated Firewall).
Check if the firewall is running.
$ sudo ufw status
You should get the following output.
Status: inactive
Allow SSH port so that the firewall doesn't break the current connection on enabling it.
$ sudo ufw allow OpenSSH
Open the following ports required by TeamSpeak.
- 9987/udp for Voice.
- 30033/tcp for File transfer.
- 10011/tcp for Serverquery (Raw).
- 10022/tcp for Serverquery (SSH).
- 10080/tcp for Webquery (HTTP).
$ sudo ufw allow 9987/udp $ sudo ufw allow 30033/tcp $ sudo ufw allow 10011/tcp $ sudo ufw allow 10022/tcp $ sudo ufw allow 10080/tcp
Enable the Firewall
$ sudo ufw enable Command may disrupt existing ssh connections. Proceed with operation (y|n)? y Firewall is active and enabled on system startup
Check the status of the firewall again.
$ sudo ufw status
You should see a similar output.
Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere 9987/udp ALLOW Anywhere 30033/tcp ALLOW Anywhere 10011/tcp ALLOW Anywhere 10080/tcp ALLOW Anywhere 10022/tcp ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) 9987/udp (v6) ALLOW Anywhere (v6) 30033/tcp (v6) ALLOW Anywhere (v6) 10011/tcp (v6) ALLOW Anywhere (v6) 10080/tcp (v6) ALLOW Anywhere (v6) 10022/tcp (v6) ALLOW Anywhere (v6)
Step 2 - Download TeamSpeak
Visit the TeamSpeak's download page and notice the latest version number. At the time of this tutorial, v3.13.6 is the latest version of the TeamSpeak server available.
Use the following command to download the TeamSpeak server.
$ TVERSION=3.13.6 $ wget https://files.teamspeak-services.com/releases/server/${TVERSION}/teamspeak3-server_linux_amd64-${TVERSION}.tar.bz2
Extract the downloaded archive.
$ tar -xf ./teamspeak3-server_linux_amd64-${TVERSION}.tar.bz2
Step 3 - Create TeamSpeak user and directory
The first step in installing TeamSpeak is to create a user for the server. The user will have its home directory at /opt/teamspeak
and won't have a password.
$ sudo adduser ts3 --home /opt/teamspeak --shell /bin/bash --disabled-password
Now we can move the extracted directory to /opt/teamspeak
directory.
$ sudo mv teamspeak3-server_linux_amd64/* /opt/teamspeak/
Grant correct permissions to the directory.
$ sudo chown -R ts3:ts3 /opt/teamspeak
Step 4 - Run TeamSpeak server
The next step is to run the TeamSpeak server to create a privilege key for the first time. This key will help you gain access to the server as an administrator.
Before starting the server, you need to log in as the TeamSpeak user. Run the following command to log in to your shell as the TeamSpeak user.
$ sudo -u -i ts3
For this, we will create a file called .ts3server_license_accepted
in the TeamSpeak's working directory.
$ touch .ts3server_license_accepted
Run the following command to start the server.
$ ./ts3server_startscript.sh start ------------------------------------------------------------------ I M P O R T A N T ------------------------------------------------------------------ Server Query Admin Account created loginname= "serveradmin", password= "BtXdJaCb" apikey= "BAD8rYVPM61p_-TdrsBqEL_8ZxKzEHIKOkUk6_e" ------------------------------------------------------------------ ------------------------------------------------------------------ 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=WIRagRYXkCnWqM5g7gBoSgcHHpfgLG9w17pcLORy ------------------------------------------------------------------
Running the server for the first time will create a Server Query Administrator account. Note down its user name and the password. Also, note down the API key and the privilege token generated. You will need this in the coming steps.
To stop the server, press Ctrl + C on your keyboard.
Log out as the TeamSpeak user.
$ exit
Step 5 - Creating TeamSpeak Service daemon
Create the file /lib/systemd/system/ts3server.service
and open it for editing.
$ sudo nano /lib/systemd/system/ts3server.service
Paste the following code in it.
[Unit] Description=TeamSpeak3 Server Wants=network-online.target After=syslog.target network.target local-fs.target [Service] WorkingDirectory=/opt/teamspeak User=ts3 Group=ts3 Type=forking ExecStart=/opt/teamspeak/ts3server_startscript.sh start license_accepted=1 ExecStop=/opt/teamspeak/ts3server_startscript.sh stop ExecReload=/opt/teamspeak/ts3server_startscript.sh restart Restart=always RestartSec=15 [Install] WantedBy=multi-user.target
Close the file by pressing Ctrl + X and entering Y when prompted.
Reload the service daemon.
$ sudo systemctl daemon-reload
Enable and start the TeamSpeak service.
$ sudo systemctl enable ts3server --now
Check the status of the service.
$ sudo systemctl enable ts3server ? ts3server.service - TeamSpeak3 Server Loaded: loaded (/lib/systemd/system/ts3server.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2022-03-29 08:18:17 UTC; 2s ago Process: 23120 ExecStart=/opt/teamspeak/ts3server_startscript.sh start license_accepted=1 (code=exited, status=0/SUCCESS) Main PID: 23127 (ts3server) Tasks: 21 (limit: 2341) Memory: 17.3M CPU: 1.953s CGroup: /system.slice/ts3server.service ??23127 ./ts3server license_accepted=1 daemon=1 pid_file=ts3server.pid Mar 29 08:18:17 teamspeak systemd[1]: Starting TeamSpeak3 Server... Mar 29 08:18:17 teamspeak ts3server_startscript.sh[23120]: Starting the TeamSpeak 3 server Mar 29 08:18:17 teamspeak ts3server_startscript.sh[23120]: TeamSpeak 3 server started, for details please view the log file Mar 29 08:18:17 teamspeak systemd[1]: Started TeamSpeak3 Server.
Step 6 - Connect using TeamSpeak Client
Download and Install the Windows TeamSpeak 3 Client from the official website. You can also download the latest beta version (v5) of the client, but for our tutorial, we will use the older and stable v3.
Launch the client on your desktop, and you will get the following screen after going through the license prompt.
Click on the Connections and select the Connect option to get started. Enter your server's IP address, the password generated in step 4, and a nickname for yourself.
Click the Connect button to proceed. You will be asked to enter the Privilege key in the next prompt. Enter the Privilege token from step 4 and click Ok to proceed.
You are now connected to your TeamSpeak server and can start using the client for communication.
Step 7 - Changing Access Password
You can change the Server Administrator password to a stronger one of your choice. To do that, stop the TeamSpeak service.
$ sudo systemctl stop ts3server
Switch to the TeamSpeak user.
$ sudo -i -u ts3
Start the TeamSpeak server and add the serveradmin_password
parameter in your command.
$ ./ts3server_startscript.sh start serveradmin_password=password Starting the TeamSpeak 3 server TeamSpeak 3 server started, for details please view the log file
Replace password
with a strong password of your choice.
Stop the server again.
$ ./ts3server_startscript.sh stop Stopping the TeamSpeak 3 server . done
Switch back to your user account.
$ exit
Start the TeamSpeak service again.
$ sudo systemctl start ts3server
Step 8 - Installing and configuring MySQL
TeamSpeak, by default, uses the SQLite database to store all the communication and user data. While this is fine for a small community, it can become a problem if you are using TeamSpeak to host more users. Fortunately, TeamSpeak can be configured to use either a MySQL or a PostgreSQL database.
We will configure it to use with the MySQL server.
Install MariaDB server, which is a drop-in replacement for MySQL since Debian doesn't ship with MySQL 8 by default.
$ sudo apt install mariadb-server -y
The installer will start and enable the Mariadb service for you. You can check the status of the service.
$ sudo systemctl status mariadb
Run the security script for MariaDB. Use the options given below.
$ sudo mysql_secure_installation Enter current password for root (enter for none): (Press Enter) Switch to unix_socket authentication [Y/n] Y Change the root password? [Y/n] n Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y
Log in to the MySQL shell.
$ sudo mysql
Create ts3user
user. Replace your_password
with a strong password of your choice.
mysql> CREATE USER 'ts3user'@'localhost' IDENTIFIED BY 'your_password';
Create teamspeak3
database.
mysql> CREATE DATABASE teamspeak3;
Grant the user privileges on the teamspeak3
database.
mysql> GRANT ALL PRIVILEGES ON teamspeak3.* TO 'ts3user'@'localhost';
Exit the Shell.
mysql> exit
Switch to the TeamSpeak user.
$ sudo -i -u ts3
The first step to configuring MariaDB to work with TeamSpeak is to add the MariaDB library. You can find it in the /opt/teamspeak/redist
folder.
Create a symlink for the library from the redist
folder to the main working directory.
$ ln -s /opt/teamspeak-server/redist/libmariadb.so.2 /opt/teamspeak-server/libmariadb.so.2
Run the following command to print the shared libraries required by TeamSpeak.
$ ldd /opt/teamspeak3-server/libts3db_mariadb.so
Create the configuration file for storing the database parameters and open it for editing.
$ nano ts3db_mariadb.ini
Paste the following code in it.
[config] host=127.0.0.1 port=3306 username=ts3user password=your_password database=teamspeak3 socket=
Use the database credentials created above. Close the file by pressing Ctrl + X and entering Y when prompted.
Create a configuration file for TeamSpeak and open it for editing.
$ nano ts3server.ini
Paste the following code in it.
machine_id= default_voice_port=9987 voice_ip=0.0.0.0 licensepath= filetransfer_port=30033 filetransfer_ip=0.0.0.0 query_port=10011 query_ip=0.0.0.0 query_ip_whitelist=query_ip_whitelist.txt query_ip_blacklist=query_ip_blacklist.txt dbsqlpath=sql/ dbplugin=ts3db_mariadb dbsqlcreatepath=create_mariadb/ dbpluginparameter=ts3db_mariadb.ini dbconnections=10 logpath=logs logquerycommands=0 dbclientkeepdays=30 logappend=0 query_skipbruteforcecheck=0
Close the file by pressing Ctrl + X and entering Y when prompted. To learn about these configuration settings, you can refer to the file server_quickstart.md
available in the doc
folder. The above file configures TeamSpeak to use MariaDB instead of the SQLite database.
Exit the TeamSpeak shell.
$ exit
We need to tell the TeamSpeak server to use the newly created configuration file. Stop and disable the TeamSpeak service.
$ sudo systemctl stop ts3server && sudo systemctl disable ts3server
Open the service file.
$ sudo nano /lib/systemd/system/ts3server.service
Find the line ExecStart=/opt/teamspeak/ts3server_startscript.sh start license_accepted=1
and change it by adding the configuration file details as shown below.
.... Type=forking ExecStart=/opt/teamspeak/ts3server_startscript.sh start license_accepted=1 inifile=ts3server.ini ....
Close the file by pressing Ctrl + X and entering Y when prompted.
Reload the service daemon to apply the changes.
$ sudo systemctl daemon-reload
Enable and start the TeamSpeak service.
$ sudo systemctl enable ts3server --now
Check the status of the server.
$ sudo systemctl status ts3server ? ts3server.service - TeamSpeak3 Server Loaded: loaded (/lib/systemd/system/ts3server.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2022-03-29 12:21:22 UTC; 6s ago Process: 26511 ExecStart=/opt/teamspeak/ts3server_startscript.sh start license_accepted=1 inifile=ts3server.ini (code=exited, status=0/SUCCESS) Main PID: 26518 (ts3server) Tasks: 21 (limit: 2341) Memory: 16.0M CPU: 1.818s CGroup: /system.slice/ts3server.service ??26518 ./ts3server license_accepted=1 inifile=ts3server.ini daemon=1 pid_file=ts3server.pid Mar 29 12:21:23 teamspeak ts3server_startscript.sh[26518]: apikey= "BAA_lDBRBQxy2nPJXwPQvTRk9_sX3o403Ktlbjz" Mar 29 12:21:23 teamspeak ts3server_startscript.sh[26518]: ------------------------------------------------------------------ Mar 29 12:21:24 teamspeak ts3server_startscript.sh[26518]: ------------------------------------------------------------------ Mar 29 12:21:24 teamspeak ts3server_startscript.sh[26518]: I M P O R T A N T Mar 29 12:21:24 teamspeak ts3server_startscript.sh[26518]: ------------------------------------------------------------------ Mar 29 12:21:24 teamspeak ts3server_startscript.sh[26518]: ServerAdmin privilege key created, please use it to gain Mar 29 12:21:24 teamspeak ts3server_startscript.sh[26518]: serveradmin rights for your virtualserver. please Mar 29 12:21:24 teamspeak ts3server_startscript.sh[26518]: also check the doc/privilegekey_guide.txt for details. Mar 29 12:21:24 teamspeak ts3server_startscript.sh[26518]: token=kuFsCpz8G7204KiYgQJR8X8orHR+C8OrSv21MZRw Mar 29 12:21:24 teamspeak ts3server_startscript.sh[26518]: ------------------------------------------------------------------
Doing so will recreate the privilege key. The next time you log in to your server, you will be asked for it. Your server administration password will, however, remain the same.
Step 9 - Upgrading TeamSpeak
The first step to upgrading the TeamSpeak server is to stop the server.
$ sudo systemctl stop ts3server
Download the latest version from the official website and extract the archive to the /opt/teamspeak
directory overwriting the original files by following steps 2 and 3 from the tutorial. Make sure you change the permission of the extracted folder.
Once you are finished, start the server again.
$ sudo systemctl start ts3server
Conclusion
This concludes our tutorial about installing and using TeamSpeak Server on a Debian 11 based server. If you have any questions, post them in the comments below.