Skip to content
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
This install script has been forked from an old project by Bosscoder, who has enabled my friends to use a Teamspeak server on a cheap NAT vps. Thanks bosscoder!

## NAT TS3 Installer
This installer will automatically install TeamSpeak 3 onto your NAT VPS, and automatically configure the ports to the ones you specify.

### How do I install?
To install TeamSpeak 3 automatically, run this command and follow the prompt.

``wget http://git.io/nat_ts3 --no-check-certificate -O /tmp/nat_ts3.sh && bash /tmp/nat_ts3.sh``
``wget https://raw.githubusercontent.com/pnede3/NAT-TS3-Installer/master/installer.sh --no-check-certificate -O /tmp/nat_ts3.sh && bash /tmp/nat_ts3.sh``

### Requirements
This script will only work on OpenVZ container based VPS due to the fact it only checks for venet ethernet adapter. You can modify the code of this script before you run it if you want to install on a KVM/Xen VPS.
Expand Down
38 changes: 34 additions & 4 deletions installer.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
# Easy TeamSpeak 3 installer for Debian based OS
# Tested on Debian 7/8 and Ubuntu 14.04 LTS
# And also tested on Ubuntu 16 on a cheap NAT VPS!

# Check for root account
if [[ "$EUID" -ne 0 ]]; then
Expand All @@ -20,6 +21,22 @@ pvtip=$( ifconfig | grep 'inet addr:'| grep -v '127.0.0*' | cut -d ':' -f2 | aw
# Get the external public IP of the server
pubip=$( wget -qO- http://ipinfo.io/ip )

# Ask the user if they accept the teamspeak license
read -p "Do you accept the Teamspeak License? [y/n]: " licensepermission
while true; do
if [[ "$licensepermission" == "y" ]]; then
echo "You accepted the Teamspeak License."
echo "You can view the license by using: cat /opt/ts3/LICENSE"
break
elif ! [[ "$fport" = "n" ]]; then
echo "Error: You did not accept the Teamspeak License. Quiting installation."
exit 2
break
else
break
fi
done

# Gives user the internal ip for reference and ask for desired ports
echo "Your private internal IP is: $pvtip"
read -p "Enter Voice Server port [9987]: " vport
Expand Down Expand Up @@ -71,12 +88,15 @@ fi
echo "-------------------------------------------------------"
echo "Detecting latest TeamSpeak 3 version, please wait..."
echo "-------------------------------------------------------"

#todo

wget 'http://dl.4players.de/ts/releases/?C=M;O=D' -q -O - | grep -i dir | grep -Eo '<a href=\".*\/\">.*\/<\/a>' | grep -Eo '[0-9\.?]+' | uniq | sort -V -r > TS3V
while read ts3version; do
if [[ "${ts3version}" =~ ^[3-9]+\.[0-9]+\.1[2-9]+\.?[0-9]*$ ]]; then
wget --spider -q http://dl.4players.de/ts/releases/${ts3version}/teamspeak3-server_linux_amd64-${ts3version}.tar.bz2
wget --spider -q https://files.teamspeak-services.com/releases/server/3.9.1/teamspeak3-server_linux_amd64-3.9.1.tar.bz2
else
wget --spider -q http://dl.4players.de/ts/releases/${ts3version}/teamspeak3-server_linux-amd64-${ts3version}.tar.gz
wget --spider -q https://files.teamspeak-services.com/releases/server/3.9.1/teamspeak3-server_linux_amd64-3.9.1.tar.bz2
fi
if [[ $? == 0 ]]; then
break
Expand Down Expand Up @@ -137,7 +157,8 @@ EOF
chmod 755 /etc/init.d/teamspeak3

# Assign right ports and password to TS3 server
sed -i "s/{2}/{4} default_voice_port=$vport query_port=$qport filetransfer_port=$fport filetransfer_ip=0.0.0.0 serveradmin_password=$apass/" /opt/ts3/ts3server_startscript.sh
sed -i 's/COMMANDLINE_PARAMETERS=""/COMMANDLINE_PARAMETERS="query_port='$qport' query_ip=0.0.0.0 default_voice_port='$vport' voice_ip=0.0.0.0 filetransfer_port='$fport' filetransfer_ip=0.0.0.0 serveradmin_password='$apass'"/' /opt/ts3/ts3server_startscript.sh
# Old line: sed -i "s/{2}/{4} default_voice_port=$vport query_port=$qport filetransfer_port=$fport filetransfer_ip=0.0.0.0 serveradmin_password=$apass/" /opt/ts3/ts3server_startscript.sh

# Set TS3 server to auto start on system boot
update-rc.d teamspeak3 defaults
Expand All @@ -147,14 +168,23 @@ echo ""
echo ""
clear
echo "TeamSpeak 3 has been successfully installed!"
echo ""
echo ""
echo "Accepting the license..."
touch /opt/ts3/.ts3server_license_accepted
echo "Accepted license!"
echo "Automatically configuring ports..."

echo "Voice server is available at $pubip:$vport"
echo "The file transfer port is: $fport"
echo "The server query port is: $qport"
echo ""
read -p "Start the server now? [y/n]: " startopt
sleep 1
if [ "$startopt" == "y" ] || [ "$startopt" == "yes" ]; then
echo "Please keep the following details safe!"
echo "To find your private token to configure your server, use:"
echo "cd opt/ts3/logs"
echo "cat $(ls -t1 | tail -1)"
sleep 2
/etc/init.d/teamspeak3 start
else
Expand Down