How to install Teamspeak 3 Server on Ubuntu Server

Login to your Ubuntu Server via ssh as root or another user with elevated rights.

Since the Teamspeak Server should not run as root user and admin rights we start by creating a teamspeak3 user.

adduser teamspeak3

Type a password of your choice and make sure to remember it.

Next we create the installation folder and set the appropriate rights. I like to use the /usr/local/ folder since it is acessible by anyone and is being kept unmodified when updating distribution. You could also use another directory (e.g. the home directory /home/teamspeak3) if you like.

mkdir /usr/local/teamspeak3
chown teamspeak3 /usr/local/teamspeak3

Now switch to the user teamspeak3 and navigate into the installation directory.

su teamspeak3
cd /usr/local/teamspeak3

Next we need to download the newest teamspeak version.

Download current Teamspeak Server version

Take a look at the Teamspeak download page and modify the version numbers below accordingly.
Furthermore you need to make sure if you are using the 32 or the 64bit version of Ubuntu.
64 bit version (most common on nowadays machines):

wget http://files.teamspeak-services.com/releases/3.0.12.2/teamspeak3-server_linux-amd64-3.0.10.3.tar.gz

32 bit version:

wget http://files.teamspeak-services.com/releases/3.0.12.2/teamspeak3-server_linux-x86-3.0.10.3.tar.gz

Now that we successfully downloaded the necessary packages we need to intall the Teamspeak server.

Install Teamspeak Server

First of all we unpack the archive:

tar -xzvf teamspeak3-server_linux*.tar.gz

The archive contents have now been unpacked into a subfolder named just like the archive (e.g. teamspeak-server_linux-amd64). Now we need to navigate into that folder.

If you have a Teamspeak license file (licensekey.dat) you can now copy it into the installation folder you are currently in.

Now its time to start the Teamspeak Server installation process by firing it up for the first time. To achieve that we use the startup script residing in the installation directory.

/usr/local/teamspeak3/teamspeak3-server_linux-amd64/ts3server_minimal_runscript.sh

The installation process is now going to take place.
ATTENTION: Make sure to copy or write down the loginname, password and token shown at the end of the installation.

Congratulations! You are now running your own Teamspeak Server.
Leave the shell window open since we need it later on.

Connect to Teamspeak Server

Connect to the Teamspeak Server via Teamspeak Client on your client machine and start the configuration.
On the first connection you need to input the token, which you wrote down erlier during this howto, right?

After successful connection you are now logged in as the Teamspeak Server Admin.

Now return to you shell window and stop the execution of the script by pressing CTRL + C.
That will stop your Teamspeak Server but don’t worry we will restart it soon, but this time with the correct script so that the Teamspeak Server keeps running after logging out.

Start the Teamspeak Server

/usr/local/teamspeak3/teamspeak3-server_linux-amd64/ts3server_startscript.sh start

Note: You can stop/restart the server by using the upper command but with the word stop/restart at the end instead of start.

Ok, now we made sure the server is still running after logout.
But what happens if we restart the Ubuntu Server?
To let the Teamspeak Server automatically on startup you need to make a startup script.

Create Startup Script for Teamspeak Server

To create our startup script we need to switch to root and create a new file within /etc/init.d/. Since we are working over ssh we need to use a terminal editor like vi for it.

ATTENTION: Please take care to vi’s control commands and don’t press any button except the ones described below.

Switch to root and create startup file:

su -
vi /etc/init.d/teamspeak3

In vi we press “i” to enter insertion mode and paste the contents of the file below with CTRL + V:

#!/bin/sh
### BEGIN INIT INFO
# Provides: teamspeak3
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Teamspeak 3 Server
### END INIT INFO

USER="teamspeak3";
DIR="/usr/local/teamspeak3/teamspeak3-server_linux-amd64";

###### Teamspeak 3 server start/stop script ######

case "$1" in
start)
su $USER -c "${DIR}/ts3server_startscript.sh start"
;;
stop)
su $USER -c "${DIR}/ts3server_startscript.sh stop"
;;
restart)
su $USER -c "${DIR}/ts3server_startscript.sh restart"
;;
status)
su $USER -c "${DIR}/ts3server_startscript.sh status"
;;
*)
echo "Usage: {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0

You can now modify the USER and DIR variables in the script to your needs if necessary. After finished editing be exit insertion my by pressing CTRL + C and save and quit vi by entering “:wq” (without exclamation marks).

Now we need to mark the script as executable:

chmod 755 /etc/init.d/teamspeak3

Now we have finished our script and need to add it to the scripts to be executed at startup:

update-rc.d teamspeak3 defaults

From the next reboot on Teams Speak will be started automatically.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s