Question

Setup Teamspeak Server Ubuntu 15.04

Someone asked me to write a tutorial about how to setup a teamspeak server on Ubuntu 15.04. If you got any problems after using this tutorial, please make a comment. I made this tutorial in a way I think is the best, if you got any improvements or want to use something else please tell me.

Prerequisites

  • A droplet with Ubuntu 15.04
  • An SSH client / SFTP client

What we will do

  • Install MariaDB
  • Install Teamspeak
  • Configure Teamspeak
  • Create an autostart script

Install MariaDB MariaDB is a replacement for MySQL with a better performance. The database will hold all users/settings etc. of the Teamspeak server instead of SQLlite. Inside your droplet use the following command:

sudo apt-get install mariadb-client mariadb-server

Once the install process is finished, you have to firstly setup your MariaDB install with new root password (default is blank). Issue this command:

/usr/bin/mysql_secure_installation
Enter current password for root (enter for none): Enter
Set root password? [Y/n]  Y
Remove anonymous users? [Y/n]  y
Disallow root login remotely? [Y/n] Depends on what you want
Remove test database and access to it? [Y/n]   y
Reload privilege tables now? [Y/n]   y

Now the MariaDB service should be running with a new root password.

Lets configure the database now. We will create a new user and database for the Teamspeak server. Create the database with 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

Install Teamspeak First we will create a new user with its own directory in /opt/. Then we will download the latest teamspeak server and unpack it.

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

Now download, extract, move and change permissions of the teamspeak server files:

sudo wget http://dl.4players.de/ts/releases/3.0.11.4/teamspeak3-server_linux-amd64-3.0.11.4.tar.gz
sudo tar -zxvf teamspeak3-server_linux-amd64-3.0.11.4.tar.gz
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.11.4.tar.gz teamspeak3-server_linux-amd64

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

If libmariadb.so.2 ==> not found shows, use the following command:

sudo apt-get install libmariadb2

Configure Teamspeak 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 nano /opt/teamspeak3-server/ts3server.ini

With the following inside of it:

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

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

sudo nano /opt/teamspeak3-server/ts3db_mariadb.ini

Input:

[config]
host=127.0.0.1
port=3306
username=teamspeak3
password=PASSWORD
database=teamspeak3
socket=

Now you need to change permissions of the new config files: sudo chown teamspeak3-user:teamspeak3-user /opt/teamspeak3-server -R Now the configuration is done.

Create ts3 init script of TeamSpeak3 server (autostart) sudo nano /etc/init.d/ts3 With:

#! /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

Now change permissions for the 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

Now everything should be done, and ready to go. Lets start the Teamspeak3 server for the first time: sudo /etc/init.d/ts3 start You will first see the serveradmin password and token key. Make sure you save the serveradmin password somewhere save. With this you can query inside your teamspeak server. For the token key, you can also look in the logs:

/opt/teamspeak3-server/logs

Hit enter, and its all running.

Hope this worked for you. Please do not comment or answer if it has got nothing to do with this.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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

This should read: sudo mysql -u root -p create database teamspeak3; GRANT ALL PRIVILEGES ON teamspeak3.* TO ‘teamspeak3’@‘localhost’ IDENTIFIED BY ‘PASSWORD’; flush privileges; quit

Honestly the first guide that has worked flawlessly for me in a year. Thanks for the detail and good instructions!

Hello, great guide, it worked all fine ( 99% copy/paste ^^). But i have a problem, i started the server, “ts3 status” says “Server is running”, netstat seems ok to me, logs says listenning on 0.0.0.0:9987, BUT i cant connect from my cliuent and https://www.yougetsignal.com/tools/open-ports/ says my port 9987 is closed? i need to create a firewall on my droplet? or, can i change the port? tnx :)