Install Teamspeak 3 Server on Debian Linux with Runlevel Script

At frist create with root a new account called teamspeak:

root@test:~# adduser teamspeak

Adding user `teamspeak' ...
Adding new group `teamspeak' (1001) ...
Adding new user `teamspeak' (1001) with group `teamspeak' ...
Creating home directory `/home/teamspeak' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for teamspeak
Enter the new value, or press ENTER for the default
        Full Name []:
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y

Then create a directory called /opt/teamspeak for the teamspeak server and adjust the rights:

root@test:~# mkdir /opt/teamspeak
root@test:~# chown -R teamspeak:teamspeak /opt/teamspeak

You change to the account teamspeak and go in the just created directory.
With a Browser you can get on http://www.teamspeak.com/?page=downloads the download link for wget.
Don’t use the link listed here, there could be a newer version:

root@test:~# su teamspeak

teamspeak@test:/root$ cd /opt/teamspeak
teamspeak@test:/opt/teamspeak$ wget http://teamspeak.gameserver.gamed.de/ts3/releases/3.0.11.2/teamspeak3-server_linux-amd64-3.0.11.2.tar.gz

--2015-03-08 11:28:50--  http://teamspeak.gameserver.gamed.de/ts3/releases/3.0.11.2/teamspeak3-server_linux-amd64-3.0.11.2.tar.gz
Resolving teamspeak.gameserver.gamed.de (teamspeak.gameserver.gamed.de)... 85.114.136.237
Connecting to teamspeak.gameserver.gamed.de (teamspeak.gameserver.gamed.de)|85.114.136.237|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5023834 (4.8M) [application/octet-stream]
Saving to: `teamspeak3-server_linux-amd64-3.0.11.2.tar.gz'

100%[======================================>] 5,023,834   13.37M/s   in 0.3s

2015-03-08 11:28:50 (13.37 MB/s) - `teamspeak3-server_linux-amd64-3.0.11.2.tar.gz' saved [5023834/5023834]

Extract the file. (It could be a different version as mentioned here.):

teamspeak@test:/opt/teamspeak$ tar xf teamspeak3-server_linux-amd64-3.0.11.2.tar.gz

Go in the new directory and start the server for testing.

Very important! Note all output data:

teamspeak@test:/opt/teamspeak$ cd teamspeak3-server_linux-amd64
teamspeak@test:/opt/teamspeak/teamspeak3-server_linux-amd64$ ./ts3server_startscript.sh start &

teamspeak@test:/opt/teamspeak/teamspeak3-server_linux-amd64$ Starting the TeamSpeak 3 server
TeamSpeak 3 server started, for details please view the log file

------------------------------------------------------------------
                      I M P O R T A N T
------------------------------------------------------------------
               Server Query Admin Account created
         loginname= "serveradmin", password= "XXXXXXX"
------------------------------------------------------------------


------------------------------------------------------------------
                      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=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
------------------------------------------------------------------

If everything is ok, stop the server and logout the teamspeak account.
The server should start on boot later autmatic with a runlevel script:

teamspeak@test:/opt/teamspeak/teamspeak3-server_linux-amd64$ ./ts3server_startscript.sh stop

Stopping the TeamSpeak 3 server..done

teamspeak@test:/opt/teamspeak/teamspeak3-server_linux-amd64$ exit

Create the script file /etc/init.d/ts3server:

root@test:~# nano /etc/init.d/ts3server

Enter the following in the script file:

#!/bin/sh
#
### BEGIN INIT INFO
# Provides: 		Teamspeak 3 Server
# Required-Start: 	$remote_fs $syslog $network $named $portmap
# Required-Stop:	$remote_fs $syslog
# Default-Start:	2 3 4 5
# Default-Stop:		0 1 6
# Short-Description:	Start/Stop Teamspeak 3 Server
# Description		Linux Teamspeak 3 Server
### END INIT INFO

NAME="Teamspeak 3 Server"
USER="teamspeak"
GROUP="teamspeak"
PATHTOFILE="/opt/teamspeak/teamspeak3-server_linux-amd64"
EXECFILENAME="ts3server_startscript.sh"

start() {
	echo -n "Starting $NAME..."
	/sbin/start-stop-daemon --start --quiet --chuid $USER:$GROUP --exec $PATHTOFILE/$EXECFILENAME start
}

stop() {
	echo -n "Stopping $NAME..."
	/sbin/start-stop-daemon --start --quiet --chuid $USER:$GROUP --exec $PATHTOFILE/$EXECFILENAME stop
}

restart() {
	echo -n "Restarting $NAME..."
	/sbin/start-stop-daemon --start --quiet --chuid $USER:$GROUP --exec $PATHTOFILE/$EXECFILENAME restart
}

case "$1" in
	start)
		start
	;;
	stop)
		stop
	;;
	restart)
		restart
	;;
	*)
		echo "Usage: $0 (start|stop|restart)"
		exit 1
	;;	
esac
exit 0

Save the file, set attributes and integrate it into the boot process:

root@test:~# chmod 755 /etc/init.d/ts3server
root@test:~# update-rc.d ts3server defaults

update-rc.d: using dependency based boot sequencing

The teamspeak 3 server installation is finished.
You can also start the server manually:

root@test:~# service ts3server start

Use top to see if the server is running (with the correct account).
With q you stop top:

root@test:~# top

To disable any file transfer over the teamspeak server, you can just change the associated directory to read only:

root@test:~# cd /opt/teamspeak/teamspeak3-server_linux-amd64/
root@test:/opt/teamspeak/teamspeak3-server_linux-amd64# chmod 500 files

Leave a Reply

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

*
*
*