How to install TeamSpeak3 Server on CentOS

Post Reply
User avatar
Markie
A regular
A regular
Posts: 56
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Mon Oct 01, 2012 11:55 am
Location: AS14586

How to install TeamSpeak3 Server on CentOS

Post by Markie »

Here is step-by-step a tutorial for installing a TeamSpeak3 Server on CentOS 7.X, with an additional auto-start script!

-Prerequisites // Before we get started
-General setup // Setting up your TS3 server
  • First, we'll start off by creating a new user for the TS3 server to run on (for security purposes, it's not advised to run TS3 as root) however, during this particular tutorial, we'll be using the username teamspeak, with a password of teamspeak.

    Code: Select all

    useradd teamspeak
    passwd teamspeak
    Once we have our teamspeak user created, we want to go ahead and switch to the home directory (as root) and grab the latest TS3 server files available here; http://dl.4players.de/ts/releases/ (remember that you're looking for 3.0.12.X or greater, just append the version number to file name as shown below).

    Code: Select all

    cd /home/teamspeak/
    wget http://dl.4players.de/ts/releases/3.0.12.4/teamspeak3-server_linux_amd64-3.0.12.4.tar.bz2
    At this point, we must extract the file contents and remember to set the correct permissions.

    Code: Select all

    tar -jxvf teamspeak3-server_linux_amd64-3.0.12.4.tar.bz2
    chmod 0755 -R teamspeak3-server_linux_amd64
    Now that the server files are prepared, we will be switching to our teamspeak user, going into the servers directory, and starting up TS3 for the first time.
    *please note that this step is extremely crucial, as we must obtain the server query admin account information used for administrating & modifying the server.

    Code: Select all

    su teamspeak
    cd /home/teamspeak/teamspeak3-server_linux_amd64/
    ./ts3server_startscript.sh start
    Usage, remember to always use teamspeak user (start, stop, restart & status).

    Code: Select all

    su teamspeak
    cd /home/teamspeak/teamspeak3-server_linux_amd64/
    ./ts3server_startscript.sh start
    ./ts3server_startscript.sh stop
    ./ts3server_startscript.sh restart
    ./ts3server_startscript.sh status
-Port forwarding // TS3 requires ports; 9987 udp (VoiceServer), 10011 tcp (ServerQuery) & 30033 tcp (FileTransfer)
  • Code: Select all

    firewall-cmd --permanent --zone=public --add-forward-port=port=9987:proto=udp:toport=9987
    firewall-cmd --permanent --zone=public --add-forward-port=port=10011:proto=tcp:toport=10011
    firewall-cmd --permanent --zone=public --add-forward-port=port=30033:proto=tcp:toport=30033
    firewall-cmd --reload
-Autostart script (Optional) // We will now be creating our autostart script
  • Using your favorite text editor (vi in this case) we will be creating a file named teamspeak under ini.d.

    Code: Select all

    vi /etc/rc.d/init.d/teamspeak
    Paste in the content below along with commands :wq or shortcut shift+zz to save.

    Code: Select all

    #!/bin/sh
    # chkconfig: 2345 99 10
    USER="teamspeak"
    TS3='/home/teamspeak/teamspeak3-server_linux-amd64'
    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
    More permissions!

    Code: Select all

    chmod 0755 /etc/rc.d/init.d/teamspeak
    Adding teamspeak to chkconfig with levels 2,3,4 & 5

    Code: Select all

    chkconfig --add teamspeak
    chkconfig --level 2345 teamspeak on
    Test start, stop & restart our newly created teamspeak service (you may also use status to see if the server is running)

    Code: Select all

    service teamspeak start
    service teamspeak stop
    service teamspeak restart
    service teamspeak status
Post Reply