Forum


Notice to all users

We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020

Results 1 to 13 of 13
  1. #1
    Join Date
    October 2011
    Posts
    8

    Simple teamspeak 3 server install with autostart with centos 5 (5.x)

    prerequisites: Centos 5.x 64-bit installed (this may or may not work for CentOS 6 maybe someone in thread can confirm)

    This guide is for the 64-bit version of CentOS, it should work with 32-bit version of centos if you download the 32-bit linux server and modify the path to the correct one in your init.d teamspeak file

    First off, I'm behind a router and have ISPConfig 3 installed and it has firewall that I had to unblock these ports in via my admin tool. I have CentOS firewall and SE linux DISABLED, you can add the ports you need for teamspeak in the customize section for the firewall in setup.. to edit your firewall in CentOS just use the setup command
    Code:
    setup
    The following ports will need to be forwarded if you are behind a router and opened in your firewall (or at your own risk disable firewall/SELinux)


    9987 (UDP)virtual voice server
    10011 (TCP)server query
    30033 (TCP)file transfer



    easy to install teamspeak 3.
    how to auto start teamspeak 3 server centos
    startup script for teamspeak 3 server centos

    Install and run as different user

    Code:
    useradd teamspeak
    Code:
    passwd teamspeak
    I didn't have to do this sudo was already installed on my centos 5.7 but just incase
    Code:
    yum install sudo



    Then give teamspeak some permissions and comment out a line with visudo command.
    if you haven't used VI.. when you find where you need to add text using arrow keys hit the letter "a" to begin editing, once you have added the teamspeak line(like code below) and commented out requiretty you hit "escape" then type ":wq" and hit enter..

    Code:
    visudo
    and add this right below ## Allow root to run any commands anywhere and root ALL=(All) so it looks like this
    Code:
    ## Allow root to run any commands anywhere
    root    ALL=(ALL)       ALL
    teamspeak ALL=(ALL)     ALL
    Also you will need to disable requiretty add a number sign in front of the line to comment it out so it looks like
    Code:
    #Defaults     requiretty
    good job! now get out by hitting escape then :wq then enter and login as teamspeak with your password
    Code:
    logout

    Now that you are logged in as teamspeak, let's download teamspeak 3 server
    Go to this website on your machine http://www.teamspeak.com/?page=downloads
    pick your server, (im running 64-bit centos so I choose server amd64 under linux)
    Agree to terms and conditions and it gives you a direct link to download while you are waiting.. my link is http://teamspeak.gameserver.gamed.de...4-3.0.0.tar.gz so I copy and paste, go into putty and type wget and put in link
    Code:
    wget http://teamspeak.gameserver.gamed.de/ts3/releases/3.0.0/teamspeak3-server_linux-amd64-3.0.0.tar.gz
    to extract then type
    Code:
    tar -zxvf teamspeak3-server*
    then remove tar (this will be different if you have installed a different version, just do a quick "ls" to see the file above you need to remove)
    Code:
    rm teamspeak3-server_linux-amd64-3.0.0.tar.gz
    This should put the teamspeak server directory under /home/teamspeak/teamspeak3-server_linux-amd64

    which will change if you have different version/path/user

    Now let's not start it..
    login as root
    Code:
    logout
    and go to init.d

    Code:
    cd /etc/init.d
    download my teamspeak init.d script
    Code:
    wget http://jump-jets.com/teamspeak
    if this wget command worked ^^ skip ONLY the marked off section, still need to chmod the teamspeak file..



    THIS SECTION ONLY IF HOSTED INIT.D TEAMSPEAK FILE IS DOWN
    we create teamspeak file
    Code:
    nano teamspeak
    if you don't have nano installed
    Code:
    yum install nano
    I seriously hate vi.. btw nano is easier to use

    once you have nano open insert this codePlease note, if you are copying and pasting the below code into putty, it will auto return some lines and screw up the code, you must find these lines that have been returned and straighten them out as you see in the example below
    if you have a different version of teamspeak 3, you will need to edit two lines in this file with the path to the default teamspeak start script
    this is the two lines you edit sudo -u teamspeak /home/teamspeak/teamspeak3-server_linux-amd64/ts3server_startscript.sh start"
    Code:
    #!/bin/bash
    #
    # teamspeak        Startup script for the Teamspeak 3 Server
    #
    # chkconfig: - 85 15
    # description: The Teamspeak voip server  
    #
    # processname: teamspeak
    #
    start(){
            
    
            # If using an SELinux system such as RHEL 4/5, use the command below
            # instead of the "su":
            # eval "runuser - jboss -c "$JBOSS_HOME/bin/run.sh > /dev/null 2> /dev/null &"
            # if the 'su -l ...' command fails (the -l flag is not recognized by my su cmd) try:
            #   sudo -u jboss $JBOSS_HOME/bin/run.sh > /dev/null 2> 
     
    sudo -u teamspeak /home/teamspeak/teamspeak3-server_linux-amd64/ts3server_startscript.sh start      
    
    }
    
    stop(){
            
    
            # If using an SELinux system such as RHEL 4, use the command below
            # instead of the "su":
            # eval "runuser - jboss -c "$JBOSS_HOME/bin/shutdown.sh -S &"
            # if the 'su -l ...' command fails try:
            #   sudo -u jboss $JBOSS_HOME/bin/shutdown.sh -S &
            
    sudo -u teamspeak /home/teamspeak/teamspeak3-server_linux-amd64/ts3server_startscript.sh stop
    }
    
    restart(){
            stop
            # give stuff some time to stop before we restart
            sleep 3
            # protect against any services that can't stop before we restart
            # if the 'su -l ...' command fails try:
            #   sudo -u jboss killall java
            start
    }
    
    case "$1" in
      start)
            start
            ;;
      stop)
            stop
            ;;
      restart)
            restart
            ;;
      *)
            echo "Usage: teamspeak {start|stop|restart}"
            exit 1
    esac
    
    exit 0
    PLEASE READ
    Some of these single lines are too long to fit into putty / nano length wise, I had to go through and backspace some lines that were down on line below

    Now hit ctrl+x and y then enter to save, and you will need to chmod it

    END OF SECTION


    Code:
    chmod 755 teamspeak
    good job! now turn it on for boot
    Code:
    chkconfig --levels 235 teamspeak on
    now let's start the teamspeak server
    Code:
    /etc/init.d/teamspeak start
    Once that’s done, you’ll see a login name, password and token. Keep them safe! (I highlighted and copied via "right mouse click" in putty and this screen went away) When you connect to your teamspeak it will ask for that key and you can put it in and you are an administrator.. hang on to this because you may need it again..

    Congratulations! You now have a 24/7 Team Speak 3 server.

    Troubleshooting below

    if you have issues starting the server via /etc/init.d/teamspeak start just go into the teamspeak file and make sure it looks exactly like this, it also won't work if you have teamspeak installed in a different location or different username, it's pretty easy to pick out what line in the teamspeaki file under /etc/init.d/ is actually the command to start/stop the server, restart just runs the start and stop command with a short sleep timer it's just the path to teamspeaks normal startup script with the "start" command, or for STOP the "stop" command

    the lines(basically the path to teamspeak folder) you may need to modify in the teamspeak file under /etc/init.d are below

    Code:
    sudo -u teamspeak /home/teamspeak/teamspeak3-server_linux-amd64/ts3server_startscript.sh start
    Code:
    sudo -u teamspeak /home/teamspeak/teamspeak3-server_linux-amd64/ts3server_startscript.sh stop
    EDIT: I have a new centos 5.8 x64 server with digitalocean and teampseak 3 server would not start under the new user I had to run some commands

    Code:
    mount -t tmpfs tmpfs /dev/shm
    Code:
    nano  /etc/fstab
    Add the following line to the bottom /etc/fstab
    Code:
    tmpfs /dev/shm tmpfs defaults 0 0
    save&exit file

    when inside of the teamspeak3 server directory teamspeak3-server_linux-amd64 run the following commnad
    Code:
    chown -R teamspeak:teamspeak ./
    where "teamspeak" is the user you created to run teamspeak
    Last edited by dr_patso; June 23rd, 2013 at 11:38 AM.

  2. #2
    Join Date
    October 2011
    Posts
    8
    I'm going to run through this guide at some point soon make sure everything is written properly.

  3. #3
    Join Date
    November 2009
    Location
    az
    Posts
    7
    Im new to this ive done this so whats the commands to test ??? restart stop start ???

  4. #4
    Join Date
    October 2011
    Posts
    8
    This is directed towards drzaco

    I have updated the guide

    if you followed this guide exactly, all you should have to do is go into init.d and remove teamspeak file

    Code:
    rm teamspeak
    then download mine,
    Code:
    wget http://jump-jets.com/teamspeak
    chmod it again
    Code:
    chmod 755 teamspeak
    then try and start it

    Code:
    /etc/init.d/teamspeak start
    don't forget to add it to boot

    Code:
    chkconfig --levels 235 teamspeak on
    Also you may need to do this below for it to autostart correctly.
    Code:
    visudo
    and comment out defaults requiretty so it looks like this
    Code:
    #Defaults     requiretty
    Last edited by dr_patso; October 19th, 2011 at 06:52 AM.

  5. #5
    Join Date
    October 2011
    Posts
    8
    Would appreciate any feedback on this thread... When i search for autostart teamspeak centos on google, everything is way over complicated..

    just add my script to init.d (I know nothing about linux and edited one in a few minutes to work, and I have cleaned it up a bit since then)

    modify the start lines in that file if needed

    chmod 755 the file

    run chkconfig for it to run at boot..

  6. #6
    Join Date
    October 2011
    Posts
    2
    (sorry for my english, I'm french )

    I've installed TS3 with your guide.
    At the end, when launching TS3 I've this error msg :
    "Starting the TeamSpeak 3 server
    TeamSpeak 3 server started, for details please view the log file
    /home/teamspeak/teamspeak3-server_linux-x86/ts3server_startscript.sh: ./ts3server_linux_x86: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory"

    Where is the log file ?
    I suppose it miss one component in my server ???
    Can you help me please ?
    Thx

  7. #7
    Join Date
    October 2011
    Posts
    2
    Ok, I've try with the amd64 version and it's working.
    (My CPU is an x86_64 and not an amd but...)

    Now I'll try client connexion at home in a few hours

    Is the database creating itself ??? Or must I create it manually and how ?

  8. #8
    Join Date
    October 2011
    Posts
    8
    hivasha, I'm not really sure what db you are talking about.. I'm pretty sure Teamspeak 3 server contains all the settings it needs to work properly. I haven't had a problem.

    I haven't tested, but I assume this would work for 32-bit server as well, ofcourse with the file paths modified and using 32-bit linux.

    I assume you were trying to launch the 32-bit version running on a 64-bit host and that's why it didn't work at first.

  9. #9
    Join Date
    February 2010
    Location
    Germany
    Posts
    4
    Hey there,

    can someone explain me how i put a script into the autostart by using centos?
    Google doesn't help very much.
    atm i start it manually with

    Code:
    cd /home/ts3/
    ./ts3server_startscript.sh start


    Edit by mod
    Thread Merged. Next time please use the forum search function.

    --- Merged ---

    Code:
    [[email protected] ~]$ /etc/init.d/teamspeak start
    ts3server.pid found, but no server running. Possibly your previously started server crashed
    Please view the logfile for details.
    rm: remove write-protected regular file `ts3server.pid'?
    so whats wrong /

    --- Merged ---

    ok got it:
    if you have installed ts3 as root you have to set the ts folder to the "teamspeak" usergroup
    als Root:
    cd /home/
    chown -R teamspeak directory
    Last edited by florian_fr40; December 26th, 2011 at 07:54 AM.

  10. #10
    Join Date
    April 2009
    Location
    DXB
    Posts
    9
    Hello,

    I have been running my TS3 server on the root for more than one year now. I have made the following changes into the script. As Am running Centos 5.7 32bit

    sudo -u root /root/teamspeak3-server_linux-x86/ts3server_startscript.sh start
    sudo -u root /root/teamspeak3-server_linux-x86/ts3server_startscript.sh stop

    When applying the code
    /etc/init.d/teamspeak start

    I get a long list of this error
    sudo: /root/teamspeak3-server_linux-x86/ts3server_startscript.sh: command not found

    Anything done wrong ?

    Regards,,,

  11. #11
    Join Date
    February 2012
    Location
    Barcelona
    Posts
    5
    I confirm that this does not work with CentOS 6. I'll Keep on searching.

  12. #12
    Join Date
    February 2016
    Posts
    2
    Iīve edited the "/etc/init.d/teamspeak" script so there will be also the "status" option available and also you need now to define only once which user and which path your system has. So you didnīt have to change it 3 times.
    Thanks to dr_patso for the work of creating a guide.

    Code:
    #!/bin/bash
    #
    # teamspeak        Startup script for the Teamspeak 3 Server
    #
    # chkconfig: - 85 15
    # description: The Teamspeak voip server
    #
    # processname: teamspeak
    #
    #Put in the user who shuld run the teamspeak server(the user needs to exist)
    user="teamspeak"
    #Put in the Path of the directory of your teamspeak server
    path="/home/${user}/teamspeak3-server_linux-x86/"
    
    
    start(){
    
    
            # If using an SELinux system such as RHEL 4/5, use the command below
            # instead of the "su":
            # eval "runuser - jboss -c "$JBOSS_HOME/bin/run.sh > /dev/null 2> /dev/null &"
            # if the 'su -l ...' command fails (the -l flag is not recognized by my su cmd) try:
            #   sudo -u jboss $JBOSS_HOME/bin/run.sh > /dev/null 2>
    
    sudo -u ${user} ${path}ts3server_startscript.sh start
    
    }
    
    stop(){
    
    
            # If using an SELinux system such as RHEL 4, use the command below
            # instead of the "su":
            # eval "runuser - jboss -c "$JBOSS_HOME/bin/shutdown.sh -S &"
            # if the 'su -l ...' command fails try:
            #   sudo -u jboss $JBOSS_HOME/bin/shutdown.sh -S &
    
    sudo -u ${user} ${path}ts3server_startscript.sh stop
    }
    
    status(){
    
    
            # If using an SELinux system such as RHEL 4, use the command below
            # instead of the "su":
            # eval "runuser - jboss -c "$JBOSS_HOME/bin/shutdown.sh -S &"
            # if the 'su -l ...' command fails try:
            #   sudo -u jboss $JBOSS_HOME/bin/shutdown.sh -S &
    
    sudo -u ${user} ${path}ts3server_startscript.sh status
    }
    
    restart(){
            stop
            # give stuff some time to stop before we restart
            sleep 3
            # protect against any services that can't stop before we restart
            # if the 'su -l ...' command fails try:
            #   sudo -u jboss killall java
            start
    }
    
    case "$1" in
      start)
            start
            ;;
      stop)
            stop
            ;;
      restart)
            restart
            ;;
      status)
            status
            ;;
      *)
            echo "Usage: teamspeak {start|stop|restart}"
            exit 1
    esac
    
    exit 0

  13. #13
    Join Date
    November 2016
    Posts
    1
    Quote Originally Posted by dr_patso View Post
    Code:
    visudo
    and add this right below ## Allow root to run any commands anywhere and root ALL=(All) so it looks like this
    Code:
    ## Allow root to run any commands anywhere
    root    ALL=(ALL)       ALL
    teamspeak ALL=(ALL)     ALL
    Also you will need to disable requiretty add a number sign in front of the line to comment it out so it looks like
    Code:
    #Defaults     requiretty
    good job! now get out by hitting escape then :wq then enter
    Love the guide but need to point out that this editing of sudoers using visudo does not seem to be necessary. Effectively you are giving the teamspeak user root access which I think is a security risk and I don't think that it's required - it certainly wasn't for me.

    Cheers,
    Ben

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Resolved] How-To install TeamSpeak 3.0.0 Server | CentOS
    By 13lackHawk in forum Linux / FreeBSD
    Replies: 43
    Last Post: February 4th, 2016, 11:28 PM
  2. Official Autostart Script on CentOS 6.4
    By Karloz in forum Linux / FreeBSD
    Replies: 2
    Last Post: August 7th, 2013, 10:28 AM
  3. [Resolved] Autostart on Centos
    By ministorm in forum Linux / FreeBSD
    Replies: 10
    Last Post: February 20th, 2012, 10:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •