Installing and setting up TS3 on a Linux CentOs VPS with Auto Restart

You do not want to run teamspeak as the root user. We will start with creating a user, password and setting the file permissions correctly. You will need to login to your server using Putty or another ssh program. I personally use WinSCP and PuTTy.

Resources:

WinSCP

PuTTY

Auto Restart Script for TS3 Linux VPS

Click here to watch the full screencast on installing TeamSpeak 3


The first step is creating the user for your TS3 installation.

useradd ts3user
You need to create a password for the user. You will need to enter the password 2 times.
passwd ts3user

You will need to change the file permissions for the user to 0755. You do this by running the following command.

chmod 755 /home/ts3user

Once the user is created and file permissions set you will need to switch to that user.

su ts3user

Now you need to go into the directory

cd /home/ts3user

Once in the directory, you need to download the version of teamspeak you want to use. You can get that from http://www.teamspeak…page=downloads
I am using 64bit CentOs 6.5 Final, so I will use the following url.
http://teamspeak.gameserver.gamed.de/ts3/releases/3.0.10.3/teamspeak3-server_linux-amd64-3.0.10.3.tar.gz

To download the file simply copy the url and paste it into the command window by right clicking. You will need to use the wget command before the url. It will look like this.
wget http://teamspeak.gameserver.gamed.de/ts3/releases/3.0.10.3/teamspeak3-server_linux-amd64-3.0.10.3.tar.gz

Once the file is downloaded you need to unpack it. (Change the version number to the version you downloaded)
tar -zxvf teamspeak3-server_linux-amd64-3.0.10.3.tar.gz

Now you need to delete the downloaded file.
rm teamspeak3-server_linux-amd64-3.0.10.3.tar.gz

We can now change the name of the folder so it is a little shorter.
mv teamspeak3-server_linux-amd64 teamspeak3-server

Now you will need to go into that directory.
cd teamspeak3-server

You do not have a ts3server.ini file yet so we need to create one. This is the file we will need to edit so we can change the ip address and ports if needed.
./ts3server_minimal_runscript.sh createinifile=1

You will get some information including your master token key. Copy it by highlighting it and using normal copy ctrl+c. Now you need to edit the ts3server.ini file. You can download this file from the root/home/ts3user/teamspeak3-server_linux-amd64 folder on your server. For starters, you just need to add the ip address for the voice connection. You can also edit the file from command line by doing the following:
nano ts3server.ini

Upload the file and then start the server. If you used nano just hit Ctrl + O and hit enter to save. Then press Ctrl + X to exit that file.
./ts3server_startscript.sh start

Your server is now running. You can stop, start and restart the server with the same command. You simply need to change the command at the end.
./ts3server_startscript.sh stop

./ts3server_startscript.sh restart

Creating the Auto Restart Service

You will want to switch to the root user and then root directory.
su root

cd ~

Now we need to create the script in the /etc/init.d folder.
nano /etc/init.d/teamspeak

Once you are in the file paste the following code into the file by right clicking the mouse.

#!/bin/sh

# chkconfig: 2345 99 10

USER=”ts3user”

TS3=’/home/ts3user/teamspeak3-server’

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


Click Ctrl + O to save the file then Ctrl + X to exit the file. We can then set the file permission so it will work properly.

chmod 755 /etc/init.d/teamspeak


Now we need to add the service so it will restart when the server is restarted. Enter the following commands and then restart the server.

chkconfig –add teamspeak


chkconfig –level 2345 teamspeak on


Once the server restarts connect to teamspeak and make sure everything restarted. You can also check the status through command line by using the following command.

service teamspeak status


That is all! Your Teamspeak 3 server should be running smooth on your VPS server. If you make a mistake and need to start over, you can easily remove the user and user directory from the server by using the following command.

userdel -r ts3user


I hope this helps.

Thanks,

You may also like...