How to Install TeamSpeak Server on Debian 8

Hello,

A lot of people seem to have trouble setting up a teamspeak 3 server so I wrote a little tutorial to help those people.

The following list is not (yet) covered by me in this tutorial, maybe I will update this later. For now: Google is your friend.
TODO:

  • securing ssh connection
  • proper firewall configuration

For this setup I have a basic Debian 8 on a Virtual Machine with root access over ssh.

  • Step 1: Create a user.


This will create a user called “teamspeak”, that has no password and without being asked for input. (I recommend using a certificate instead of password)

Code:
adduser --disabled-password --gecos "" teamspeak
  • Step 2: Create a folder.


This will create a folder for the teamspeak 3 server and grand rights to the user “teamspeak”.

Code:
mkdir /opt/teamspeak
chown teamspeak:teamspeak /opt/teamspeak/
chmod 0770 /opt/teamspeak/
  • Step 3: Create a service script.


Create a script to manage the teamspeak 3 server.

Code:
vim /etc/systemd/system/teamspeak3server.service

Press the “insert”-button and enter the following code:

Code:
[Unit]
Description=Teamspeak 3 Server

[Service]
ExecStart=/opt/teamspeak/ts3server_startscript.sh start
ExecStop=/opt/teamspeak/ts3server_startscript.sh stop
PIDFile=/opt/teamspeak/ts3server.pid
Type=forking
User=teamspeak
Group=teamspeak

[Install]
WantedBy=multi-user.target

Save and close the file by pressing the “escape”-button and typing:

Code:
:wq

Set proper rights and reload the systemctl daemon.

Code:
chmod 664 /etc/systemd/system/teamspeak3server.service
systemctl daemon-reload
systemctl enable teamspeak3server.service
  • Step 4: Grant proper rights.


Grand user “teamspeak” sudo rights to manage the service.

Code:
visudo

Search for and add the following lines:

Code:
# Cmnd alias specification
Cmnd_Alias TEAMSPEAK_CMDS = /bin/systemctl start teamspeak3server, /bin/systemctl stop teamspeak3server, /bin/systemctl restart teamspeak3server, /bin/systemctl status teamspeak3server

# User privilege specification
teamspeak ALL=NOPASSWD: TEAMSPEAK_CMDS, /sbin/reboot

Press the following button combination: “Ctrl + X”, press the “Y”-button and press the “Enter”-button.

  • Step 5: Setup actual teamspeak 3 server.


Download and install teamspeak 3 server.

While in terminal as “root” now login as user “teamspeak” by typing the following:

Code:
sudo -iu teamspeak

Download, unpack, move and remove archive:

Code:
wget http://dl.4players.de/ts/releases/3.0.13.8/teamspeak3-server_linux_amd64-3.0.13.8.tar.bz2
tar xfv teamspeak3-server_linux_amd64-3.0.13.8.tar.bz2
mv ~/teamspeak3-server_linux_amd64/* /opt/teamspeak/
rm -rf ~/teamspeak3-server_linux_amd64*

Now startup your server with the following command, this will generate some important keys that will have to save to a file on the server itself (less secure) or on your pc (recommended):

Code:
/opt/teamspeak/ts3server_startscript.sh start

When you saved the output to file I recommend to reboot the physical server to test the automatic start function, type:

Code:
sudo reboot

After this you can manage the “teamspeak 3 server”-service as user “teamspeak” with the following commands:

Code:
sudo systemctl start teamspeak3server
sudo systemctl stop teamspeak3server
sudo systemctl restart teamspeak3server
sudo systemctl status teamspeak3server

Now you can try to connect to your teamspeak server using the client, you will need the generated key you have saved earlier.

Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *