Installing and setting up TS3 on a Linux CentOs VPS with Auto Restart

By -

This will walk you through the simple steps on how to setup a TeamSpeak 3 server on linux. This can be very useful if you wanted to run a TeamSpeak 3 server on a VPS and have complete control of it. Personally I like using a VPS Server to run TeamSpeak 3. It gives me complete control and I don’t need to rely on another provider. When I first went to install TeamSpeak 3 on a Linux server I found it was a little tricky. After a few rounds of trial and error I found a very simple process and was up and running in less than 10 minutes. Below are the simple steps I took to get my TeamSpeak 3 server up and running in a few minutes.

 

You do not want to run teamspeak as the root user. We will start with creating a user, password and setting the file permissions correctly. You will need to login to your server using Putty or another ssh program. I personally use WinSCP and PuTTy.

Resources:

WinSCP
PuTTY
Auto Restart Script for TS3 Linux VPS

Click here to watch the full screencast on installing TeamSpeak 3


 

The first step is creating the user for your TS3 installation.
useradd ts3user

You need to create a password for the user. You will need to enter the password 2 times.
passwd ts3user

You will need to change the file permissions for the user to 0755. You do this by running the following command.
chmod 755 /home/ts3user

Once the user is created and file permissions set you will need to switch to that user.
su ts3user

Now you need to go into the directory
cd /home/ts3user

Once in the directory, you need to download the version of teamspeak you want to use. You can get that from http://www.teamspeak…page=downloads
I am using 64bit CentOs 6.5 Final, so I will use the following url.
http://teamspeak.gameserver.gamed.de/ts3/releases/3.0.10.3/teamspeak3-server_linux-amd64-3.0.10.3.tar.gz

To download the file simply copy the url and paste it into the command window by right clicking. You will need to use the wget command before the url. It will look like this.
wget http://teamspeak.gameserver.gamed.de/ts3/releases/3.0.10.3/teamspeak3-server_linux-amd64-3.0.10.3.tar.gz

Once the file is downloaded you need to unpack it. (Change the version number to the version you downloaded)
tar -zxvf teamspeak3-server_linux-amd64-3.0.10.3.tar.gz

Now you need to delete the downloaded file.
rm teamspeak3-server_linux-amd64-3.0.10.3.tar.gz

We can now change the name of the folder so it is a little shorter.
mv teamspeak3-server_linux-amd64 teamspeak3-server

Now you will need to go into that directory.
cd teamspeak3-server

You do not have a ts3server.ini file yet so we need to create one. This is the file we will need to edit so we can change the ip address and ports if needed.
./ts3server_minimal_runscript.sh createinifile=1

You will get some information including your master token key. Copy it by highlighting it and using normal copy ctrl+c. Now you need to edit the ts3server.ini file. You can download this file from the root/home/ts3user/teamspeak3-server_linux-amd64 folder on your server. For starters, you just need to add the ip address for the voice connection. You can also edit the file from command line by doing the following:
nano ts3server.ini

Upload the file and then start the server. If you used nano just hit Ctrl + O and hit enter to save. Then press Ctrl + X to exit that file.
./ts3server_startscript.sh start

Your server is now running. You can stop, start and restart the server with the same command. You simply need to change the command at the end.
./ts3server_startscript.sh stop
./ts3server_startscript.sh restart

Creating the Auto Restart Service

You will want to switch to the root user and then root directory.
su root
cd ~

Now we need to create the script in the /etc/init.d folder.
nano /etc/init.d/teamspeak

Once you are in the file paste the following code into the file by right clicking the mouse.
#!/bin/sh
# chkconfig: 2345 99 10
USER="ts3user"
TS3='/home/ts3user/teamspeak3-server'
STARTSCRIPT="$TS3/ts3server_startscript.sh"
cd $TS3
case "$1" in
'start')
su $USER -c "$STARTSCRIPT start"
;;
'stop')
su $USER -c "$STARTSCRIPT stop"
;;
'restart')
su $USER -c "$STARTSCRIPT restart"
;;
'status')
su $USER -c "$STARTSCRIPT status"
;;
*)
echo "Usage $0 start|stop|restart|status"
esac

Click Ctrl + O to save the file then Ctrl + X to exit the file. We can then set the file permission so it will work properly.
chmod 755 /etc/init.d/teamspeak

Now we need to add the service so it will restart when the server is restarted. Enter the following commands and then restart the server.
chkconfig --add teamspeak
chkconfig --level 2345 teamspeak on

Once the server restarts connect to teamspeak and make sure everything restarted. You can also check the status through command line by using the following command.
service teamspeak status

That is all! Your Teamspeak 3 server should be running smooth on your VPS server. If you make a mistake and need to start over, you can easily remove the user and user directory from the server by using the following command.
userdel -r ts3user

I hope this helps.
Thanks,

I am a web developer and linux server administrator. I like helping people learn new things. I am a WordPress and CSS junkie.

30 Comments to Installing and setting up TS3 on a Linux CentOs VPS with Auto Restart

  1. How secure is this?

    Is there anything else I should do to make sure it’s more secure.

    I deal with a bunch of kids who know a little bit about Linux servers than I do, and do not want them snooping around. My passwords that I use are “uncrackable.” To crack it, I determine they would take over several years, hopefully.

    TeamSpeak is the only software that is installed on this VPS, so as long as my passwords are secure, there shouldn’t be an easy way some kids with scripts can get access, right?

    • @Sparkks,

      As long as your server itself is secure your TeamSpeak should also be secure. I have setup several and know of several people that use this script running on a Linux VPS with CentOS 6.5. Most have been running for over a year and no reports of any issues with security or crashing.

  2. I’m destroy my default sshd_config file in /etc/ssh/ on my VPS and I’m recover this to default one. After this I’m trying to connect with my TS3 server on this same VPS. OS says me TS is ON and everything is fine but… no… 🙁

    [root@vps75870 ~]# service teamspeak restart Stopping the TeamSpeak 3 server..done
    Starting the TeamSpeak 3 server
    TeamSpeak 3 server started, for details please view the log file
    [root@vps75870 ~]# service teamspeak status
    Server is running .

    When I’m trying to connect with it I received: Failed to connect to server. I’m not edited any ports etc.

    Any advice? 🙁

    • Did you check the error logs to see what it says? What Operating System is your VPS using?

      Also, make sure your host records have the right ip if you just rebuilt the vps.

      • Thanks for reply.
        I’m using CentOS 6.5 on my VPS.
        Still has this same IP.
        Where I can fint log to see that?

        • Did you already copy the “teamspeak” file back into the /etc/init.d/ ?

          If you already have everything back where it is supposed to go please check to make sure the /etc/init.d/teamspeak file is chmod to 755.

          Also check the /home/ts3user folder and make sure everything in that folder is owned by the user “ts3user” and not “root”.

          Let us know.
          Thanks,

          • Ok, File teamspeak on init.d is fine (755).
            Everything in folder ts3user is owned by this user.

            In last log file from /home/ts3user/teamspeak3-server I see something like this: 2014-06-29 20:33:31.758358|INFO |VirtualServer | 1| listening on 0.0.0.0:9987

  3. 2014-06-29 20:33:30.590221|INFO |ServerLibPriv | | TeamSpeak 3 Server 3.0.10.3 (2014-01-01 16:28:39)
    2014-06-29 20:33:30.590381|INFO |ServerLibPriv | | SystemInformation: Linux 2.6.32-042stab090.5 #1 SMP Sat Jun 21 00:15:09 MSK 2014 x86_64 Binary: 64bit
    2014-06-29 20:33:30.591509|INFO |DatabaseQuery | | dbPlugin name: SQLite3 plugin, Version 2, (c)TeamSpeak Systems GmbH
    2014-06-29 20:33:30.591591|INFO |DatabaseQuery | | dbPlugin version: 3.7.3
    2014-06-29 20:33:30.591959|INFO |DatabaseQuery | | checking database integrity (may take a while)
    2014-06-29 20:33:30.615436|WARNING |Accounting | | Unable to find valid license key, falling back to limited functionality
    2014-06-29 20:33:31.702176|INFO | | | Puzzle precompute time: 1077
    2014-06-29 20:33:31.702636|INFO |FileManager | | listening on 0.0.0.0:30033
    2014-06-29 20:33:31.758561|INFO |CIDRManager | | updated query_ip_whitelist ips: 127.0.0.1,
    2014-06-29 20:33:31.759408|INFO |Query | | listening on 0.0.0.0:10011

    • Did you change the ip to 0.0.0.0:9987 to hide the real ip or is that what it is showing on your end?

      If it is really showing you that, please check the file located in /home/ts3user/teamspeak3-server/ts3server.ini. Make sure the ips are not the 0.0.0.0:9987 and the 0.0.0.0 is your server ips.

      Thanks,
      Ed

      • I’m not hiding my IP.
        My ts3server.ini looks good:
        machine_id=1
        default_voice_port=9987
        voice_ip=37.187.244.160
        licensepath=
        filetransfer_port=30033
        filetransfer_ip=37.187.244.160
        query_port=10011
        query_ip=37.187.244.160
        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
        query_skipbruteforcecheck=0

      • Ok, It’s works. I don’t know how but works.
        Maybe after replace sshd_config it will take some time to refresh… .
        No idea… 🙂
        Anyway REALLY THANK YOU FOR YOUR HELP. I really appreciate this.

        • hey, I have the same problem as you, and I followed all the steps that you did, but I don’t get that with the sshd_config

        • Same problem as well i did all the steps and i actually know how to use ssh a bit. Won’t let me join the server yet it says it’s running. If anyone sees this please help!

  4. Yep, It’s works but I’m loosing Server Admin Rights (I’m log In using this same nick).
    How can I change this?

    • I’m not really sure how to change the permissions to be honest. I would have to look into how to change them from the settings manually through ssh. If I get a chance I will that for you. It might be easier to setup and install a fresh copy though.

  5. Hi i got a problem after finish with all the steps:
    service teamspeak status and what appears is

    Server seems to have died

  6. i am having this error when i try to run service teamspeak status
    env: /etc/init.d/teamspeak: No such file or directory
    plssss help !!!

    • ok now i am getting
      Do you have the right TS3 Server package for your system? You have: Linux x86_64, not Linux i386.
      Server is running
      but the server is not restarting on reboot and the TS3 version is correct cos i am able to start it with the script manually….

      • Krishna,

        I have never ran across that error. You do have to make sure that your server is running CentOs 6 or higher and is 64bit. I have installed this 100’s of times following these same steps and never get any of these errors unless I overlooked a step or didn’t pay attention to what operating system the user had.

        I would also double check and make sure you downloaded the Teamspeak linux 64bit server.

  7. Hallo Edward

    We tryd last night several Times to set the Teamspeak up, but we fails constantly that we didnt made it Running…

    See below our last loggs after the last Reboot:

    2014-11-21 06:46:13.718554|INFO |ServerLibPriv | | TeamSpeak 3 Server 3.0.7.1 (2013-03-18 10:56:27)
    2014-11-21 06:46:13.719834|INFO |DatabaseQuery | | dbPlugin name: SQLite3 plugin, Version 2, (c)TeamSpeak Systems GmbH
    2014-11-21 06:46:13.719870|INFO |DatabaseQuery | | dbPlugin version: 3.7.3
    2014-11-21 06:46:13.720427|INFO |DatabaseQuery | | checking database integrity (may take a while)
    2014-11-21 06:46:13.746409|WARNING |Accounting | | Unable to find valid license key, falling back to limited functionality
    2014-11-21 06:46:14.247741|ERROR |Accounting | | local accounting reports an already running instance, instance will shutdown
    2014-11-21 06:46:14.247834|ERROR |ServerLibPriv | | Server() error while starting servermanager, error: instance limit reached
    2014-11-21 06:46:14.247871|CRITICAL|Time | | Assertion “m_instance != __null” failed at common/time/customtime.cpp:115;

    2014-11-21 06:47:33.296345|INFO |ServerLibPriv | | TeamSpeak 3 Server 3.0.7.1 (2013-03-18 10:56:27)
    2014-11-21 06:47:33.323054|INFO |DatabaseQuery | | dbPlugin name: SQLite3 plugin, Version 2, (c)TeamSpeak Systems GmbH
    2014-11-21 06:47:33.326228|INFO |DatabaseQuery | | dbPlugin version: 3.7.3
    2014-11-21 06:47:33.334895|INFO |DatabaseQuery | | checking database integrity (may take a while)
    2014-11-21 06:47:33.412875|WARNING |Accounting | | Unable to find valid license key, falling back to limited functionality
    2014-11-21 06:47:33.458638|INFO |FileManager | | listening on 0.0.0.0:30033
    2014-11-21 06:47:33.461331|ERROR | | | TS3ANetwork::ResolveHostName failed error: -2 (Name or service not known) 2
    2014-11-21 06:47:33.461422|ERROR | | | Could not open default UDP connection for weblist
    2014-11-21 06:47:33.476989|ERROR |VirtualSvrMgr | | loading VirtualServer(1) failed to start, error: invalid file path

    2014-11-21 06:47:33.476408|ERROR |VirtualServer | 1| Unable to create virtualserver filetransfer internal/icons directory : files
    2014-11-21 06:47:33.481616|INFO |VirtualServer | 1| stopped

    Do you have any Idea what we did wrong?

    Thanks for the Reply

    Best Regards
    Mat

  8. I have a problem,when i put the chkconfig –add teamspeak command line it says
    -bash: chkconfig: command not found
    What can I do? I really need that script,could you help me?

  9. Hi, how can i increase client limit from 32 to 500 without applying for npl. is there any code that i can use to change this from server?

    • It is really easy to apply for NPL… I’ve done it myself and got the license file really quickly… so no problem there…

      AFAIK there is no code you can use to upgrade the client limit, just because 32 IS the hard limit for non-licensed TS3 Servers… BUT if only 32 Slots are needed, you do not need to apply for the npl… (and in this case I would not recommend doing so)… But otherwise, why not?

  10. Ok so i went through all the steps very carefully and everything went smooth but when i try to connect to my server it says error: Failed to connect to server. I looked and everything is under ts3user, the ini file is setup correctly and so is the script in /etc/init.d folder. After i did all the steps and rebooted then typed in service teamspeak status, it says running so im extremely confuse. I did check logs and this is what came up

    2015-08-04 23:38:12.807953|INFO |ServerLibPriv | | TeamSpeak 3 Server 3.0.11.3 (2015-04-13 13:26:31)
    2015-08-04 23:38:12.808836|INFO |ServerLibPriv | | SystemInformation: Linux 2.6.32-504.30.3.el6.x86_64 #1 SMP Wed Jul 15 10:13:09 UTC 2015 x86_64 Binary: 64bit
    2015-08-04 23:38:12.818770|INFO |DatabaseQuery | | dbPlugin name: SQLite3 plugin, Version 2, (c)TeamSpeak Systems GmbH
    2015-08-04 23:38:12.822280|INFO |DatabaseQuery | | dbPlugin version: 3.6.21
    2015-08-04 23:38:12.850625|INFO |DatabaseQuery | | checking database integrity (may take a while)
    2015-08-04 23:38:12.966770|WARNING |Accounting | | Unable to find valid license key, falling back to limited functionality
    2015-08-04 23:38:15.214855|INFO | | | Puzzle precompute time: 2148
    2015-08-04 23:38:15.237996|INFO |FileManager | | listening on 0.0.0.0:30033
    2015-08-04 23:38:15.456085|INFO |CIDRManager | | updated query_ip_whitelist ips: 127.0.0.1,
    2015-08-04 23:38:15.479975|INFO |Query | | listening on 0.0.0.0:10011

    2015-08-04 23:38:15.454692|INFO |VirtualServer | 1| listening on 0.0.0.0:9987

  11. Hi, i used these guide to install ts3 server w/o probelms on Ccentos 6.5
    I,m planning to update server to Centos 7.0

    Can i use these guide to reinstall ts3 server on Centos 7.0 or there are something difference?

    Ty

  12. Not working.

    I can’t get server to start on user.. It says that it’s running but I cant connect as client.

  13. Hello and thank you for the great guide.

    One thing i would like to ask is why everytime i run the ‘service teamspeak status’ after the server reboot, logged on as ts3user, it asks for root password?

    Is there anything i can edit to the script?

    Kind regards

Leave a Reply

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