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:
- queryipblacklist.txt
- queryipwhitelist.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.
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.
×
nice tutorial :) quick and efficient, I can confirm this works fine on debian jessie
unable to init database, doesn’t work if i copy paste everything running ubuntu 15.04
Edit: Never mind, i’m an idiot. Forgot to change password to my own in this command: GRANT ALL PRIVILEGES ON teamspeak3.* TO teamspeak3@localhost IDENTIFIED BY ‘PASSWORD’;
@schinsue No problem, these things can happen. If you just copy past everything without reading (like I sometimes do as well) you don’t see things like that. Good you got it working!
Hey there. Awesome tutorial.
Uhm… when I try to install libmariadb2 on 64-bit Ubuntu 14.04 (trusty), I can’t find the package.
When I run this, as per the instructions....
I get this:
Everything else worked fine except for this.
@TrevorLaneRay Hello, thank you for the compliment. Yes this package isn’t included in the trusty version yet, please use the following command and then follow the tutorial again:
If you got any more questions don’t hesistate to ask them.
Oh, that’s awesome. I was pulling out my hair trying to figure out what I did wrong.
So looking at schinsue’s comment, I have to change this command…
to include the password like so…?
@TrevorLaneRay Good, yes that text between quotes is the password you want to use.
Awesomesauce. Thanks for all your help. Total newb to sql databases here. ^u^
Well i got one problem. After everything done right i cant run my server. I got error
“sudo: -: command not found”
@paticzek
Wich operating system are you using? And please give me the full command you are trying to execute.
what if I’m already using MySql and don’t want to replace it with MariaDB?
This is an excellent guide, I used this to setup a TS server a few days ago and it worked flawlessly. My only “problem” (truthfully it is not so much a problem as it is curiosity) is the next day a new TS server version was released. So I’m now wondering what would be the process for upgrading the TS server after having followed this method.
As sort of a continuance of my previous post, I have some updates to this guide as some of the steps have changed slightly (newer TS server releases are .tar.bz2 instead of .tar.gz and the file name format has changed):
These changes are all in the section labeled ’Now download, extract, move and change permissions of the teamspeak server files:’
Additionally, updating the server is simple:
Shutdown the server:
Follow this modified ’Now download, extract, move and change permissions of the teamspeak server files:’ section:
sudo /etc/init.d/ts3 start
I followed your guide step by step, but ran into the issue when starting the server
@RS7588 be sure that the password of teamspeak user in mysql and /opt/teamspeak3-server/ts3db_mariadb.ini match, and privileges
Hi, everything worked perfectly for me, but when I run “/opt/teamspeak3-server/logs” all it does is tell me “is a directory.” I can’t get the privilege key without the file, so if I can’t fix that, everything was useless. :/
EDIT: Changed access, nothing is in the folder…
EDIT AGAIN: Removed the folder, redid the tutorial, for some reason I got the token this time, thank you Cryptic! Everything works fine!
Hi, how can I setup an external MariaDB? I want to connect to the MariaDB over the DigitalOcean Private Networking. I tried it but I failed. TeamSpeak says:
2016-08-02 10:46:22.231297|CRITICAL|ServerLibPriv | |Server() unable to initialize database
TeamSpeak 3 server could not start
What can I do now?
Hello, I’d like to move my server from one server to another. How do I do it keeping all the server’s information and config?
This does have to do with this guide - as I think its important to other new users new to ubuntu and servers to know this answer -
I have one ubuntu 16001 droplet server running with nginx , php, mysql db… If I follow this guide to also install and host TS, will this mess up my other mysql DB and can i run it on the same droplet? I also have my own domain… so, an i follow this guide and setup the ts server to point to say ts.mydomain.com?
@TopMax Since DigitalOcean didn’t accept me as a tutorial writer I made my own blog. Please visit cryptic-designs.net and make a comment on the Teamspeak tutorial. I will answer all questions there since this topic is getting overloaded a bit.
Be aware that the blog is still being improved.
@BatmanJK This is possible with different sort of ways. Please make a comment at cryptic-designs.net and I will explain both ways.
@ronniem71 This tutorial should not mess up anything else on your current setup. You can use this without being worried about anything getting messen up by it. If you got any other questions please visit cryptic-designs.net
First off, awesome tutorial. I am, however having an issue. I followed the instructions (on Ubuntu 16.04), however I get the following when I try to start the TS3 server for the first time.
I tried looking in the logs folder, but it doesn’t exist (there are also no errors that show on the screen). I’ve checked netstat, which didn’t show anything listening. I’ve also looked for the process, however it doesn’t seem to be running (although the .pid file is there).
Any suggestions?
Having an error: unable to create tables. Anyone come across this problem? I followed everything in the tutorial I thought.
@shdwtek Do you get any specific error? Most of the time the logs say it all.
Hello,
is there a way to allow the access to the ts3-server via client only for a special vhost or cname?
For Example:
My IP is 192.0.2.0
My domain is example.com
now i want to access the ts3 server only by using ts.example.com
and “block” the ip-address access
@alexanderstudte basically a domain record IS an IP address. A domain is just an easier way for humans to remember something. So no, you can’t block an IP address from connecting.
HOWEVER, you can sort of bypass this. For example;
If you change your teamspeak server port to a non-default port (for example 6135) and people try to connect by IP, they won’t be able to connect because they have to also fill in the (secret) port.
With this, you can create a DNS A record and SRV record so when they fill in the A record, they will be redirected to the Teamspeak server.
If you need more help with this, or don’t understand this don’t hesistate to ask another question.