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.
- 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
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:
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
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/220.127.116.11/teamspeak3-server_linux-amd64-18.104.22.168.tar.gz sudo tar -zxvf teamspeak3-server_linux-amd64-22.214.171.124.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-126.96.36.199.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
We are going to configure TeamSpeak3 server with the MySQL-MariaDB database,
We have to manually create configfiles:
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
[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
#! /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:
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.