Dear clients,

with this questions and answers-entry we would like to give you the opportunity to automatically install and start a Teamspeak 3 Voice Server.
Therefor we prepared a script which you can perform on your VPS. With this script your server will be automatically installed and started.

Note: Make sure the bzip2 and ca-certificates packages are installed.

1) Log in to your server via SSH and enter the following command in the main directory to create the executable file "ts3install.sh" and edit it with a file editor, in this example we use "nano".

nano ts3install.sh

2) Copy (STRG + C) the script below and paste it (STRG + V) into the file. (Note: you can customize the installation directory, the version to install, and the Linux user running Teamspeak in the script)

IMPORTANT: This script has only been tested on Debian and Ubuntu. On other systems, the script may not work.

#!/bin/bash

#########################################
# Teamspeak 3 Server Installer
# Version 3.9.1
# last Update 27.08.2019
# by SIGNALTRANSMITTER.de
#########################################

c=`tput setaf 6`
w=`tput setaf 7`
r=`tput setaf 1`
y=`tput setaf 3`

### THOSE VARIABLES CAN BE CHANGED
#TEAMSPEAK USERNAME
user="teamspeak"

#INSTALLATIONS-PFAD
installdir="/home/$user/ts/"

#TEAMSPEAK VERSION
version="3.9.1"

############################################

x64="https://files.teamspeak-services.com/releases/server/$version/teamspeak3-server_linux_amd64-$version.tar.bz2"
x86="https://files.teamspeak-services.com/releases/server/$version/teamspeak3-server_linux_x86-$version.tar.bz2"

echo "This script installs Teamspeak Server version $ r [$ version] $ w completely automatically. The function is not guaranteed !$w"
echo "$y[ ACHTUNG ] Um die Version anzupassen, bitte die Variablen im Script editieren!"

if [ -e /etc/locale.gen ]; then
    echo "$c[ INFO ]$w Locales werden installiert"
    sed -i "s/^# de_DE/de_DE/" /etc/locale.gen >/dev/null
    grep -v "^#" /etc/locale.gen >/dev/null
    /usr/sbin/locale-gen >/dev/null
    update-locale LANG=de_DE.UTF-8 >/dev/null
else
    echo "$c[ INFO ]$w Fehler beim konfigurieren von locales"
fi

if [ $(dpkg-query -W -f='${Status}' bzip2 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
    echo "$c[ INFO ]$w Installiere Abhängigkeit bzip2"
    apt-get update;
    apt-get install -y bzip2;
fi

if [ $(dpkg-query -W -f='${Status}' ca-certificates 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
    echo "$c[ INFO ]$w Installiere Abhängigkeit ca-certificates"
    apt-get update;
    apt-get install -y ca-certificates;
fi

ts3u=`cut -d: -f1 /etc/passwd | grep teamspeak`

if [ "$ts3" = "teamspeak" ]; then
    echo "$c[ INFO ]$w Der User $ts3u existiert schon. Bitte den User im Script anpassen."
    exit
else
    echo "$c[ INFO ]$w Erstelle Teamspeak-User..."
    useradd $user
fi

echo "$c[ INFO ]$w Die Installation beginnt automatisch in 5 Sekunden..."
sleep 5

if [ -d "$installdir" ]; then
    echo "$r[ ERROR ]$w Das Verzeichnis $installdir existiert bereits. Breche ab!"
    exit
else
    echo "$c[ INFO ]$w Das Verzeichnis $installdir existiert nicht. $installdir wird erstellt..."
    mkdir -p $installdir
fi

cd $installdir

if [ $(uname -m) == 'x86_64' ]; then
    #64bit
    wget -q $x64
    tar xfj teamspeak3-server_linux_amd64*
    echo "$c[ INFO ]$w Entferne gepacktes Archiv..."
    cd "teamspeak3-server_linux_amd64"
    mv * .. && cd .. && rm -rf teamspeak3-server_linux_amd64* && cd .. && chown -R $user:$user $installdir
    echo "$c[ INFO ]$w Der Teamspeak Server wird erstmalig gestartet..."
    cd $installdir
    touch .ts3server_license_accepted
    su -c "./ts3server_minimal_runscript.sh > ADMIN &" -s /bin/bash $user
    sleep 5 && ps aufwx | grep teamspeak | grep -v grep | awk '{print $2}'
    echo "$c[ INFO ]$w Bitte den Token sowie Serveradmin-Login gut hinterlegen..."
else
    #32bit
    wget -q $x86
    tar xfj teamspeak3-server_linux_x86*
    echo "$c[ INFO ]$w Entferne gepacktes Archiv..."
    cd "teamspeak3-server_linux_x86"
    mv * .. && cd .. && rm -rf teamspeak3-server_linux_amd64* && cd .. && chown -R $user:$user $installdir
    echo "$c[ INFO ]$w Der Teamspeak Server wird erstmalig gestartet..."
    touch .ts3server_license_accepted
    cd $installdir
    su -c "./ts3server_minimal_runscript.sh > ADMIN &" -s /bin/bash $user
    sleep 5 && ps aufwx | grep teamspeak | grep -v grep | awk '{print $2}'
    echo "$c[ INFO ]$w Bitte den Token sowie den Serveradmin-Login gut hinterlegen..."
fi

echo "$c[ INFO ]$w Soll Teamspeak in den Autostart installiert werden? [y/n]"
read -n1 -p "" autostart
case $autostart in
  y|Y)
     echo -e "\n$c[ INFO ]$w Der Startparameter wurde im Autostart hinterlegt."
     echo "su -c '$installdir/ts3server_startscript.sh start' -s /bin/bash $user" | tee --append /etc/rc.local > /dev/null
    ;;
    *)
     echo -e "\n$c[ INFO ]$w Der Startparameter wird$y nicht$w in den Autostart geschrieben."
    ;;
esac
echo "$c[ INFO ]$w Der Teamspeak Server wird nun automatisch gestartet..."

3) Save the entry with CTRL + O and close the program "nano" with CTRL + X.

4) Give the script the necessary rights to execute the script with the following command:
chmod +x ts3install.sh

5) Run the script to install your Teamspeak server. Enter the following command. (Note: During the installation, you can additionally select whether you want to write Teamspeak in the autostart)
./ts3install.sh

6) The script installs and starts your Teamspeak server. In addition, you will get the data of an administrator account and your token with which you can connect to the server in order to manage it.

The installation is now complete and you can reach the Teamspeak server via the IP of your VPS. The file "ts3install.sh" can be removed.

SIGNALTRANSMITTER.de - Hosting hat 4,62 von 5 Sternen | 472 Bewertungen auf ProvenExpert.com