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 4 of 4
  1. #1
    Join Date
    April 2007
    Location
    Germany
    Posts
    18

    [Howto] Install a Teamspeak server outside of an account's home dir

    Greetings!

    The recommended way to install a Teamspeak server is to download it to a particular home directory (mostly a user called "teamspeak" or the likes) and then start it from there.
    However, I think that this is suboptimal, and I definitely prefer any program to reside in a standard directory and still be fully operable. Fortunately Teamspeak offers virtually everything to facilitate this.

    First of all, download the Teamspeak server and unpack it. You are getting almost all files that are needed - and the only file that you need to write yourself is actually a three-liner. You will also want to use an LSB script to handle server startup and shutdown (you can find a version below that works for openSuSE - even systemd can handle this so there's no need to write a unit file for Teamspeak. Please note that other distros may require a modified script!). If you are using MariaDB you also need to create an additional config file in /etc.

    To get things done, just let's assume that you are attempting to install the server in /usr/local/bin (assuming a 64-bit Linux - if your Linux is 32 bit, the destination for your libraries must be /usr/lib instead of /usr/lib64).

    Now you just proceed like this:
    1. Unpack the archive and cd to the directory created by the process.
    2. Do a groupadd -r teamspeak.
    3. Do a useradd -r teamspeak -g teamspeak.
    4. Do a mv ts3server /usr/local/bin.
    5. If you are using sqlite, do a mv libts3db_sqlite.so /usr/lib64 (in case you are using MariaDB move the file libts3db_mariadb instead).
    6. Do a mv libts3_ssh.so /usr/lib64.
    7. Do a mv redist/libmariadb.so.2 /usr/lib64.
    Please note: Since /usr/lib64 is on the default library path, the libraries that we have placed here are automatically found when the Teamspeak server starts up. There's no need to set LD_LIBRARY_PATH.
    8. Create a directory to hold your server's data (like mkdir /opt/teamspeak).
    9. Move the sql and serverquerydocs directories as well as the LICENSE file to the freshly created directory.
    10. Do a chgrp -R teamspeak /opt/teamspeak.
    11. Do a chmod -R g+w /opt/teamspeak.
    12. Do a chmod o-rx /opt/teamspeak.
    13. Do a mkdir /var/log/teamspeak.
    14. Do a chgrp teamspeak /var/log/teamspeak.
    15. Do a chmod g+w /var/log/teamspeak.
    16. Create a file /etc/ts3db.conf and set the following:
    Code:
    [config]
    host=127.0.0.1
    port=3306
    username=<username>
    password=<password>
    database=teamspeak
    socket=
    Now, with all files in place, it's time to get to setting up the Teamspeak server. First of all, we need to get to Teamspeak's data directory so do a cd /opt/teamspeak.
    Once there, proceed with the following steps:
    1. Invoke ts3server logpath=/var/log/teamspeak/ createinifile=1 inifile=/etc/ts3.conf license_accepted=1 licensepath=/opt/teamspeak/. This creates a config file in the directory /etc (any config files normally reside there) and fills it with reasonable defaults. Once the server has started up, terminate it with CTRL-C.
    MariaDB users, please note: You will want to add the parameters dbplugin=ts3db_mariadb, dbsqlcreatepath=create_mariadb/ and dbpluginparameter=/etc/ts3db.conf to the program call so that you get the correct plugin and SQL scripts to get your database up and running!
    2. Do a chgrp teamspeak query_ip_*.
    3. Do a chmod g+w query_ip_* (makes these files writable for group "teamspeak" - failing to do so is likely to screw things up, and the server might show unexpected behavior).
    4. Do a chown -r teamspeak.teamspeak files (failing to do so is a sure way to provoke errors).
    5. Have a look at /etc/ts3.conf and check it for any errors that may be there (i. e. setting the wrong plugins or directories - if there are any mistakes, the server is not going to start later). You may also take the chance to fine-tune the server if you know what to do here.

    Now you are almost done. To get things going, first write your wrapper script (it needs to switch to Teamspeak's working directory, because for some reason startproc doesn't propagate this, but instead resets it to somewhere you don't want it).

    Do a cd /usr/local/bin and open your editor there. Simply paste the following lines of code into it:
    Code:
    #!/bin/bash
    
    cd /opt/teamspeak
    exec /usr/local/bin/ts3server inifile=/etc/ts3.conf
    Save it as ts3_wrapper and make it executable by everyone (chmod a+x ts3_wrapper).

    Then go to /etc/init.d and open your editor there. Now paste the following script into it:
    Code:
    #!/bin/bash
    ### BEGIN INIT INFO
    # Provides: teamspeak
    # Required-Start: $network mysql
    # Required-Stop:  $network mysql
    # Default-Start:  3 5
    # Default-Stop:   0 1 2 6
    # Description:    Launches the Teamspeak VoIP server
    # Short-Description: Start Teamspeak
    ### END INIT INFO
    
    test -r /etc/rc.config && . /etc/rc.config
    
    TS_BIN=/usr/local/bin/ts3_wrapper
    test -x $TS_BIN || exit 5
    
    . /etc/rc.status
    
    rc_reset
    
    case "$1" in
        start)
            echo -n "Starting Teamspeak server "
            startproc -u teamspeak -g teamspeak $TS_BIN
    
            rc_status -v
            ;;
        stop)
            echo -n "Shutting down Teamspeak server "
            killproc -TERM ts3server
    
            rc_status -v
            ;;
        try-restart)
            $0 status >/dev/null &&  $0 restart
    
            rc_status
            ;;
        restart)
            $0 stop
            sleep 1
            $0 start
            sleep 1
    
            rc_status
            ;;
        force-reload)
            echo -n "Reload Teamspeak server "
            $0 stop  &&  $0 start
    
            rc_status
            ;;
        reload)
            echo -n "Reload Teamspeak server "
            killproc -HUP ts3server
    
            rc_status -v
            ;;
        *)
            echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|relo
            exit 1
            ;;
    esac
    rc_exit
    (MariaDB users only) Make sure to create the database necessary for Teamspeak, for otherwise the server refuses to start!
    1. Invoke mysql -p
    2. Enter the following command:
    Code:
    CREATE DATABASE teamspeak CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    (Source: https://dba.stackexchange.com/questi...et-utf-8/76789)
    3. Create a new database user (use the name that you have set in /etc/ts3db.conf) and grant it all privileges. Also make sure to set a password for the user (must match the password provided in ts3db.conf!) so that Teamspeak can access the database. If you are the only person working on the server and aren't accepting any MySQL requests from an external source, you may as well omit the password.

    Now that everything is in place, feel free to fire up your server.
    Execute systemctl enable teamspeak.service and systemctl start teamspeak.service and enjoy your new server!

    I have done my best to reproduce the steps that I have taken to get this setup running. If you are experiencing any problems with this procedure, please let me know so I can fix it. Please make sure to provide information on what is going wrong where as it narrows down the point that is causing trouble.
    Last edited by Chris; August 14th, 2018 at 08:32 AM.

  2. #2
    Join Date
    December 2004
    Location
    RF
    Posts
    3,008

  3. #3
    Join Date
    April 2007
    Location
    Germany
    Posts
    18
    However, our approaches aren't necessarily the same. Here /opt/teamspeak is merely used to store data - the other relevant files have been moved to sensible locations within the Linux directory tree.

  4. #4
    Join Date
    December 2004
    Location
    RF
    Posts
    3,008

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 77
    Last Post: November 2nd, 2012, 10:45 AM
  2. Replies: 10
    Last Post: February 21st, 2011, 11:03 PM

Tags for this Thread

Posting Permissions

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