«

»

Jan 24

How to install and configure TeamSpeak3 Server- Linux – Debian – Ubuntu

How to install and configure TeamSpeak3 Server- Linux – Debian – Ubuntu

 

Create user dedicated for TeamSpeak3 server.

Home directory for TeamSpeak3 user – /opt.

sudo useradd -d /opt/teamspeak3-server -m teamspeak3-user

Install TeamSpeak3 server for Linux 64bit.

Download TeamSpeak3 server, unpack to home directory, and change file permission of our user home directory.

sudo wget http://dl.4players.de/ts/releases/3.0.12/teamspeak3-server_linux_amd64-3.0.12.tar.bz2
sudo tar -jxvf teamspeak3-server_linux_amd64-3.0.12.tar.bz2
sudo mkdir /opt/teamspeak3-server
sudo mv teamspeak3-server_linux_amd64/* /opt/teamspeak3-server
sudo chown teamspeak3-user:teamspeak3-user /opt/teamspeak3-server -R
sudo rm -fr teamspeak3-server_linux_amd64-3.0.12.tar.bz2 teamspeak3-server_linux_amd64

 

Install TeamSpeak3 server for Linux 32bit.

Download TeamSpeak3 server, unpack to home directory, and change file permission of user home directory.

sudo wget http://dl.4players.de/ts/releases/3.0.12/teamspeak3-server_linux_x86-3.0.12.tar.bz2
sudo tar -jxvf teamspeak3-server_linux_x86-3.0.12.tar.bz2
sudo mkdir /opt/teamspeak3-server
sudo mv teamspeak3-server_linux_x86/* /opt/teamspeak3-server
sudo chown teamspeak3-user:teamspeak3-user /opt/teamspeak3-server -R
sudo rm -fr teamspeak3-server_linux_x86-3.0.12.tar.bz2 teamspeak3-server_linux-x86

 

Firewall configuration – iptables.

-A INPUT -p udp --dport 9987 -j ACCEPT
-A INPUT -p tcp --dport 10011 -j ACCEPT
-A INPUT -p tcp --dport 30033 -j ACCEPT

 

DNS server configuration – Bind9.

Add to your domain 2 records.
Change domain.com to your own domain name.

_ts3._udp.domain.com. 86400 IN SRV 0 5 9987 domain.com.
_tsdns._tcp.domain.com. 86400 IN SRV 0 5 41144 domain.com.

 

Teststing DNS server.

sudo nslookup -type=SRV _ts3._udp.domain.com

or

sudo nslookup -q=SRV _ts3._udp.domain.com

 

Server:         127.0.0.1
Address:        127.0.0.1#53

_ts3._udp.domain.com        service = 0 5 9987 domain.com.

 

Configure database MySQL – MariaDB.

Create database teamspeak3 and user teamspeak3 for TeamSpeak3 server.
Change database PASSWORD to your own password.

sudo mysql -u root -p
create database teamspeak3;
GRANT ALL PRIVILEGES ON teamspeak3.* TO teamspeak3@localhost IDENTIFIED BY 'PASSWORD';
flush privileges;
quit

 

Symlink library libmariadb.so.2 from /redist folder to TeamSpeak3 server directory.

sudo ln -s /opt/teamspeak3-server/redist/libmariadb.so.2 /opt/teamspeak3-server/libmariadb.so.2

 

Run ldd to prints the shared libraries required by TeamSpeak3 server.

sudo ldd /opt/teamspeak3-server/libts3db_mariadb.so

 

Create configfiles for TeamSpeak3 server.

The configfiles can be created automatically by script:
./ts3server_minimal_runscript.sh with option createinifile=1.
This method allows running the server with a SQL database.

We are going to configure TeamSpeak3 server with the MySQL-MariaDB database,
We have to manually create configfiles:

  • query_ip_blacklist.txt
  • query_ip_whitelist.txt
  • ts3server.ini
  • ts3db_mariadb.ini
 

Create blacklist configfile.

sudo touch /opt/teamspeak3-server/query_ip_blacklist.txt

 

Create whitelist configfile.

sudo cat  << EOT > /opt/teamspeak3-server/query_ip_whitelist.txt
127.0.0.1
EOT

 

Create configfile with MySQL-MariaDB database option.

sudo cat << EOT > /opt/teamspeak3-server/ts3server.ini
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
dbsqlpath=sql/
dbplugin=ts3db_mariadb
dbsqlcreatepath=create_mariadb/
dbpluginparameter=ts3db_mariadb.ini
dbconnections=10
logpath=logs
logquerycommands=0
dbclientkeepdays=30
logappend=0
query_skipbruteforcecheck=0
EOT

 

Create configfile for database for TeamSpeak3 server.
Change PASSWORD for database of TeamSpeak3, use the same password you have created configuring MySQL database.

sudo cat << EOT > /opt/teamspeak3-server/ts3db_mariadb.ini
[config]
host=127.0.0.1
port=3306
username=teamspeak3
password=PASSWORD
database=teamspeak3
socket=
EOT

 

Change permissions for new configfiles.

sudo chown teamspeak3-user:teamspeak3-user /opt/teamspeak3-server -R

 

Create ts3 init script of TeamSpeak3 server (autostart).

sudo nano /etc/init.d/ts3
#! /bin/sh
### BEGIN INIT INFO
# Provides:          ts3
# Required-Start:    $network mysql
# Required-Stop:     $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: TeamSpeak3 Server Daemon
# Description:       Starts/Stops/Restarts the TeamSpeak Server Daemon
### END INIT INFO

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="TeamSpeak3 Server"
NAME=teamspeak3-server
USER=teamspeak3-user
DIR=/opt/teamspeak3-server
OPTIONS=inifile=ts3server.ini
DAEMON=$DIR/ts3server_startscript.sh
#PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

sleep 2
sudo -u $USER $DAEMON $1 $OPTIONS

 

Change permission for ts3, ts3server_startscript.sh and ts3server_minimal_runscript.sh scripts.

sudo chmod a+x /etc/init.d/ts3
sudo chmod a+x /opt/teamspeak3-server/ts3server_startscript.sh
sudo chmod a+x /opt/teamspeak3-server/ts3server_minimal_runscript.sh
sudo update-rc.d ts3 defaults

 

First run of TeamSpeak3 server with MySQL – MAriaDB database.

Remember login – “serveradmin”,  password and token key.

sudo /etc/init.d/ts3 start
------------------------------------------------------------------
                      I M P O R T A N T
------------------------------------------------------------------
               Server Query Admin Account created
         loginname= "serveradmin", password= "jFB2A0Kg"
------------------------------------------------------------------


------------------------------------------------------------------
                      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=h0Tzk54RbwnrWmhJlmBTMkfg4I+iAzKEkLsMZUYK
------------------------------------------------------------------

 

Commands for ts3 script:

sudo /etc/init.d/ts3 {start|stop|restart|status}
Usage: ./ts3server_startscript.sh {start|stop|restart|status}

 

 

Test listening of TeamSpeak3 server.

sudo netstat -lnp | grep ts3
tcp    0      0 0.0.0.0:30033     0.0.0.0:*      LISTEN      21779/ts3server_lin
tcp    0      0 0.0.0.0:10011     0.0.0.0:*      LISTEN      21779/ts3server_lin
udp    0      0 0.0.0.0:9987      0.0.0.0:*                  21779/ts3server_lin

 

Download, install and configure TeamSpeak3 client.

Download TeamSpeak3 client from link below:
http://dl.4players.de/ts/releases/3.0.16/TeamSpeak3-Client-win64-3.0.16.exe

 

Run and configure TeamSpeak3 client.

Select Connections then select Connect.
Fill the boxes:

  • Server Address: domain.com (your own domain name or IP address),
  • Nickname: serveradmin,
  • Server Password: password generated by TeamSpeak3 server when you run the server firs time.

 

Select Connect

TeamSpeak3-connection
Now enter the token key and select OK.

TeamSpeak3-token-key
From now you can fully manage your own TeamSpeak3 server.

13 comments

Skip to comment form

  1. Dan

    I tried your auto start script method, and I feel like I’m missing something as I can’t seem to change the default port in the /opt/teamspeak3-server/ts3server.ini file, whenever I reboot the server it changes to the default port.

    1. sethuper

      The init script is a simple Starts/Stops/Restarts the TeamSpeak Server Daemon.
      If your configfile is overwritten after reboot then change the permission to read only:

      sudo chattr +i /opt/teamspeak3-server/ts3server.ini

      to remove permission:

      sudo chattr -i /opt/teamspeak3-server/ts3server.ini

  2. Aaron

    Thank you. It works perfectly on my Linux VPS.

  3. Karppi

    When trying to start the server for the first time, it gives me this error:

    /etc/init.d/ts3: 28: /etc/init.d/ts3: sudo: not found

    Any idea what I’m doing noobily wrong?

    1. sethuper

      Install and configure sudo or use root account to configure and run script:
      su
      password: root_password
      then
      nano /etc/init.d/ts3
      or
      /etc/init.d/ts3: star stop...

  4. demontraven

    hey,

    I get the following error when trying to start TS server through script:
    2015-11-13 12:56:02.194334|ERROR |DatabaseQuery | | mysql_real_connect() failed with error: Access denied for user ‘teamspeak3’@’localhost’ (using password: YES)
    2015-11-13 12:56:02.194533|CRITICAL|ServerLibPriv | | Server() unable to initialize database

    Output from ldd also seemed strange as it couldn’t find libmariadb.so.2

    linux-vdso.so.1 => (0x00006d7787515000)
    libmariadb.so.2 => not found
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00006d7786f0d000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00006d7786b47000)
    /lib64/ld-linux-x86-64.so.2 (0x00006d7787516000)

    Do you have any tips to resolve this?

    1. sethuper

      Username or password for teamspeak3 database must be wrong.
      don’t bother about this thing for now: libmariadb.so.2 => not found

  5. Muzak

    Hello,
    I followed every step of your guide but when i start the server it gives me this output:

    Starting Teamspeak 3 server
    TeamSpeak 3 server started, for details please view the log file
    root@vps:/opt/teamspeak3-server# 2015-12-09 19:35:00.193009|CRITICAL|ServerLibPriv | | Server() unable to initialize database

    can you help me please?

    1. sethuper

      did you create database (unable to initialize database)?

  6. Mike Edwards

    Hi
    I’ve done all of the above and have created the init script and “sudo /etc/init.d/ts3 start” comes back as
    “Starting the Teamspeak 3 server”
    “Teamspeak 3 server started ….”
    But when I connect through my client I get “Failed to connect to server”

    Strangely when I run “./ts3server_minimal_runscript.sh” manually I can connect to the server and use it normally albeit when “sudo /etc/init.d/ts3” start hasn’t already been ran or is stopped.

    Any ideas?

    1. sethuper

      check logs: /opt/teamspeak3-server/logs

  7. Mia E

    Hi im getting an error when entering sudo chown for the install saying:

    chown: invalid user: ‘ teamspeak3-user:teamspeak3-user’

    I’m very new to this sort of thing and could definitely use some help!

    Thanks

    1. sethuper

      You didn’t/forgot create user: teamspeak3-user

Leave a Reply

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