Main Contents

Teamspeak 3 on CentOS 6

May 17, 2012

Create a user account for the Teamspeak service to run under

# useradd teamspeak
# passwd teamspeak

To use a MySQL database, you need to install additional libraries not available from the default repositories. Download MySQL-shared-compat-6.0.11-0.rhel5.x86_64.rpm (This is 64 bit version. If you are on a 32 bit system, you’ll need to find it somewhere) and install

# yum localinstall MySQL-shared-compat-6.0.11-0.rhel5.x86_64.rpm

If you are going to use a MySQL database, and assuming you already have a functional MySQL installation, create a database and user for Teamspeak:

# mysql
mysql> create database ts3db;
mysql> grant all on ts3db.* to 'ts3user'@'localhost' identified by 'ts3password';
mysql> flush privileges;

Create a init script for Teamspeak at /etc/init.d/teamspeak

#!/bin/bash
# /etc/init.d/teamspeak
# version 0.3.6 2011-10-17 (YYYY-MM-DD)

### BEGIN INIT INFO
# Provides:   teamspeak
# Required-Start: $local_fs $remote_fs
# Required-Stop:  $local_fs $remote_fs
# Should-Start:   $network
# Should-Stop:    $network
# Default-Start:  2 3 4 5
# Default-Stop:   0 1 6
# Short-Description:    Teamspeak 3 Server
# chkconfig: 2345 94 05
# Description:    Starts the Teamspeak 3 server
### END INIT INFO

#Settings
SERVICENAME='Teamspeak 3'
SPATH='/home/teamspeak/teamspeak3-server_linux-amd64'
SERVICE='/home/teamspeak/teamspeak3-server_linux-amd64/ts3server_startscript.sh'
OPTIONS='inifile=ts3server.ini'
USERNAME='teamspeak'

ME=`whoami`
as_user() {
  if [ $ME == $USERNAME ] ; then
    bash -c "$1"
  else
    su - $USERNAME -c "$1"
  fi
}

mc_start() {
    echo "Starting $SERVICENAME..."
    cd $SPATH
    as_user "cd $SPATH && $SERVICE start ${OPTIONS}"
}

mc_stop() {
    echo "Stopping $SERVICENAME"
    as_user "$SERVICE stop"
}

#Start-Stop here
case "$1" in
  start)
    mc_start
    ;;
  stop)
    mc_stop
    ;;
  restart)
    mc_stop
    mc_start
    ;;
  *)
  echo "Usage: /etc/init.d/teamspeak {start|stop|restart}"
  exit 1
  ;;
esac

exit 0

Now login as the teamspeak user, download Teamspeak Server 3 64-bit for Linux and extract in your home directoy

$ tar -xf teamspeak3-server_linux-amd64-3.0.5.tar.gz
$ cd teamspeak3-server_linux-amd64

If you are using MySQL, create a file called ts3server.ini which contains:

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
dbplugin=ts3db_mysql
dbpluginparameter=ts3db_mysql.ini
dbsqlpath=sql/
dbsqlcreatepath=create_mysql/
dbconnections=10
logpath=logs
logquerycommands=0
dbclientkeepdays=30
logappend=0

If you NOT using MySQL, and using sqlite instead, create a file called ts3server.ini which contains:

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
dbplugin=ts3db_sqlite3
dbpluginparameter=
dbsqlpath=sql/
dbsqlcreatepath=create_sqlite/
dbconnections=10
logpath=logs
logquerycommands=0
dbclientkeepdays=30
logappend=0

If you are using MySQL, create a file called ts3db_mysql.ini which contains:

[config]
host=localhost
port=3306
username=ts3user
password=ts3password
database=ts3db
socket=

Start Teamspeak

$ ./ts3server_startscript.sh start inifile=ts3server.ini

You should get a message about the Server Query Admin account created - take note of the loginname and password. Stop the server with

$ ./ts3server_startscript.sh stop

Check the logs in the logs directory. If everything is OK, log back in as root, enable the service and start it

# chmod +x /etc/init.d/teamspeak
# chkconfig --add teamspeak
# chkconfig teamspeak on
# service teamspeak start

Filed under: Uncategorized |

Sorry, the comment form is closed at this time.