view content/Coding/031-setting-up-a-teamspeak-3-server-on-ubuntu-14.04.rst @ 25:e85738e65064 tip

Remove Twitter widget
author Brian Neal <bgneal@gmail.com>
date Mon, 15 Feb 2021 13:32:38 -0600
parents d6221e37c59e
children
line wrap: on
line source
Setting Up a Teamspeak 3 Server on Ubuntu 14.04
###############################################

:date: 2015-11-08 22:32
:tags: teamspeak,ubuntu
:slug: setting-up-a-teamspeak-3-server-on-ubuntu-14.04
:author: Brian Neal

Here is a quick guide for setting up a `Teamspeak 3`_ server on Ubuntu 14.04.

First you need to obtain the latest version of the Teamspeak 3 server software.
You can see what they have available on the `Teamspeak downloads page`_. At the
time of this writing, the server software is found on a "server" tab. You'll
want to pick either the 32 or 64-bit version depending on your Ubuntu
installation. You can either download the package to your local computer and
copy it to your server, or get it directly from your server. I used this
command on my server::

   $ wget http://dl.4players.de/ts/releases/3.0.11.4/teamspeak3-server_linux-amd64-3.0.11.4.tar.gz

You can poke around on the downloads page using a web browser to find the URL
for the latest verison by visiting http://dl.4players.de/ts/releases/.

Next, unpack the archive file::

   $ tar xvfz teamspeak3-server_linux-amd64-3.0.11.4.tar.gz 

A good place to install it is `/usr/local/`, so let's do that::

   $ sudo mv teamspeak3-server_linux-amd64 /usr/local/teamspeak

It's a very good idea to create a new user to run the Teamspeak service. We'll
create a system user called ``teamspeak`` that can't login with this command::

   $ sudo adduser --system --group --disabled-login --no-create-home teamspeak

Now we'll ensure this new user owns all the files::

   $ sudo chown -R teamspeak:teamspeak /usr/local/teamspeak

Next we'll create the infrastructure needed to launch the Teamspeak service on
server startup. The server files we downloaded include a suitable startup
script already. We'll just have to make sure our new ``teamspeak`` user runs this
script. Use your favorite editor to create a new file::

   $ sudo vi /etc/init.d/teamspeak

This new file will simply ``sudo`` to the new ``teamspeak`` user and then run the
startup script. Your new ``/etc/init.d/teamspeak`` file should contain the
following::

   #!/bin/sh
   sudo --user=teamspeak /usr/local/teamspeak/ts3server_startscript.sh $@

Notice the trailing ``$@``. This is important for forwarding the usual arguments
like ``stop``, ``start``, and ``restart`` to the Teamspeak script.

Now we'll finish the process of ensuring our script can be run at server
startup and shutdown::

   $ sudo chmod u+x /etc/init.d/teamspeak 
   $ sudo update-rc.d teamspeak defaults

Now we can run the Teamspeak service for the very first time:: 

   $ sudo service teamspeak start

You should see some console output, including a long string of the form
``token=blahblahblah``. Make sure you copy the text after the ``token=`` part.
This magic string will allow you to obtain server admin privileges the first
time you connect to your server with a Teamspeak client. See this `article`_ 
for more information.

Finally, if you are running a firewall, you'll have to open some ports
before you can connect with your client. You should refer to the Teamspeak
article "`Which ports does the Teamspeak 3 server use?`_". At the
time of this writing, I used the following rules for `iptables`_::

   # Allow ports for Teamspeak3
   -A INPUT -p udp --dport 9987 -j ACCEPT
   -A INPUT -p tcp --dport 30033 -j ACCEPT
   -A INPUT -p tcp --dport 10011 -j ACCEPT
   -A INPUT -p tcp --dport 41144 -j ACCEPT

If you use `ufw`_ to manage your firewall, I think the following commands will
suffice::

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

Enjoy your new Teamspeak 3 server!

.. _Teamspeak 3: http://www.teamspeak.com/
.. _Teamspeak downloads page: http://www.teamspeak.com/downloads
.. _article: https://support.teamspeakusa.com/index.php?/Knowledgebase/Article/View/40/0/how-do-i-make-myself-and-then-someone-else-a-server-admin
.. _Which ports does the Teamspeak 3 server use?: https://support.teamspeakusa.com/index.php?/Knowledgebase/Article/View/44/16/which-ports-does-the-teamspeak-3-server-use
.. _iptables: https://help.ubuntu.com/community/IptablesHowTo
.. _ufw: https://help.ubuntu.com/community/UFW