Archives

Meta

TeamSpeak Servers

While Discord is making big waves in voice communications, some players still prefer using TeamSpeak. This is intended to be a quick guide on setting up your own TeamSpeak server on a free tier AWS instance.

First you’ll need to create an AWS account at https://aws.amazon.com, this is where you’ll control all of the settings for your virtual machine / instance.

Before starting, you may want to set up SSH keys in your client and import the public key to the Key Pairs menu. If you don’t have an SSH client and keys set up already, while you create your instance it will give you an opportunity to create and download a key for the initial connection to your instance. For this connection, you can use Putty (free) per the instructions provided when you click the Connect button once your instance is started, or Bitvise which is a bit prettier and easier to use for the command-line-challenged (and also free). My preferred SSH client is SecureCRT (I use it for work on a daily basis), though that has a license fee.

In the instances menu, Launch a new instance.

Choose an AMI (Amazon Machine Image). If you’re only going to be using this instance for TeamSpeak, and are not experienced with Linux, then Amazon Linux is likely the best choice for you. Make sure that you choose one that is labelled “Free tier eligible” so that you won’t be charged for run time!
As of 2018/02, Amazon Linux 2 LTS Candidate AMI 2017.12.0 is likely a good choice (and was the one I used while testing my instructions).

Choose an Instance Type. This is where you would choose the type of instance, the number of processors and memory. The important point here is to choose a Free tier eligible type. The one I used was t2.micro with 1 vCPU and 1 gigabyte of memory.

Click Configure Instance Details. Ensure that the shutdown behaviour is set to Stop (not Terminate).

Click Add Storage. There should be a note on this page that Free tier eligible customers can get up to 30 GB of storage. Set the Size of the volume to 30 GB.

Click Add Tags. There’s nothing to do here, it’s just the next step in the process.

Click Configure Security Group. By default, instances have firewall rules that block everything. You’ll need to open up a few ports in a new Security Group:

Click review and launch.

You will be presented with a window to choose a key pair. If you’ve already imported an SSH key, you should use that one. If you have never used SSH before, then let AWS create a new key pair for you, and download the file when presented. This file is REQUIRED to get into your server. If you lose it and don’t set up alternate methods of access, then you will not be able to get into your server again.

Set up an Elastic IP from the Eliastic IPs menu. This will reserve an IP address for your instance, so if you remove it and create a new instance in the future you can keep the same IP address. Once you’ve allocated a new address, you’ll need to select it, click Actions, and associate the address to your instance.

Wait a minute or two, and you’ll see that your instance is running.

The next steps are some configurations for your server. Connect to the instance via SSH. I’m not going to give every single detail of what to type for each command. Example, if you type the command “passwd ts3” it’s expected that you can follow the simple directions of “type your new password here”.

To make this easier, I’m going to assume that you’re running commands as root. It’s not a good practice to do so, and you should be using “sudo” in front of a command while logged in as your normal user instead of using “sudo su -” to become the root user.

Create a user account that you will use for yourself going forward (instead of the default account created by AWS), as well as a user account for TeamSpeak to use so that it doesn’t run as root (administrator / super user privileges):adduser ts3passwd ts3adduser crown (where you replace “crown” with your own user name)passwd crown

Go to your home directory, and add your SSH key credentials:cd /home/crownmkdir .sshvi .ssh/authorized_keys Copy paste your public key in here by hitting “i” then pasting (probably using shift-insert) then hit “escape” and type :wq to save and exit. You can use other editors than vi (vim or emacs are common). I’ve been doing this for more than 25 years, and I’m used to vi.chmod 600 .ssh/authorized_keyschown -R crown:crown .ssh

You should now log out of the server, and log back in using the account you created for yourself. This isn’t required, but it’s good practice.

Open the web site for TeamSpeak Server Downloads, find the Linux 64-bit server link, and click on the icon to copy the link to your clipboard. As of 2018/02 the link (latest version) was: http://dl.4players.de/ts/releases/3.0.13.8/teamspeak3-server_linux_amd64-3.0.13.8.tar.bz2

To download and extract the tarball (like a zip or rar file for Linux), use the following commands:cd /usr/localwget http://dl.4players.de/ts/releases/3.0.13.8/teamspeak3-server_linux_amd64-3.0.13.8.tar.bz2tar -jxf teamspeak3-server_linux_amd64-3.0.13.8.tar.bz2ln -s teamspeak3-server_linux_amd64 ts3 What we’ve done here is create a symbolic link called “ts3” that will point to the real (longer) directory name. This will make it easier in future for automatic scripts and the like.mkdir ts3/logs If you’re very picky about log locations (like me), you’ll probably create a directory at /var/log/ts3 and chown it to ts3:ts3 then symbolic link the /usr/local/ts3/logs directory to the one in /var/log/ts3. This isn’t something to be concerned with if you’re new to Linux.chown -R ts3:ts3 teamspeak3-server_linux_amd64

Next change to the ts3 user by using the command su ts3, then go to the ts3 directory and start TeamSpeak for the first time:cd /usr/local/ts3sh ts3server_startscript.sh start
You’ll see some info about the server starting, then some IMPORTANT info about login/password/token like the below.loginname= “serveradmin”, password= “somepasswordhere”token=1234awholebunchofrandomcharactershere4321
You’ll need this info the first time you log into TeamSpeak in order to authenticate as an administrator, after which you can give your ID administrative permissions and not need that info again (probably).
If something goes wrong here and you get an error message, you’re welcome to hit me up on Discord and I can help you figure out what’s wrong. Copy paste any error messages into your request for help!

Type exit to go back to your own user or the root user if that’s what you started as (from being the ts3 user). Note that in some cases on some distributions, the initial run of the TeamSpeak server has to be performed as root, after which you can chown -R ts3:ts3 /usr/local/ts3 in order to fix permissions for future running as the ts3 user.

You should now edit the accounts file to lock down the ts3 user. The command vipw is the easy way to do so, though you could just use any editor on the file /etc/passwd
The line for ts3 should look like this once you’re done with the possibility of the 1002 being another number close to that one:
ts3:x:1002:1002::/usr/local/ts3:/sbin/nologin

If you want to use a custom ini file for TeamSpeak configurations, create a file /usr/local/ts3/ts3server.ini with the contents below (the blue parts only):machine_id=default_voice_port=9987voice_ip=172.31.16.13 (change this to the internal IP address in your AWS console, or use ifconfig -a to check what it is)licencepath=licensekey.dat (needed if you buy a license for more than 32 slots)filetransfer_port=30033filetransfer_ip=172.31.16.13 (change this to the internal IP address in your AWS console, or use ifconfig -a to check what it is)query_port=10011query_ip=172.31.16.13 (change this to the internal IP address in your AWS console, or use ifconfig -a to check what it is)dbplugin=ts3db_sqlite3dbpluginparameter=dbsqlpath=sql/dbsqlcreatepath=create_sqlite/logpath=logs/logquerycommands=1

If you want to set up SystemCtl auto-start/stop scripts so that TeamSpeak starts when the system is rebooted or after a crash, you’ll need to add the file /usr/lib/systemd/system/ts3server.service with the contents below. Use this command to edit the file: vi /usr/lib/systemd/system/ts3server.service[Unit]Description=TeamSpeak 3 ServerAfter=network.target[Service]WorkingDirectory=/usr/local/ts3/User=ts3Group=ts3Type=forkingExecStart=/usr/local/ts3/ts3server_startscript.sh start inifile=ts3server.iniExecStop=/usr/local/ts3/ts3server_startscript.sh stopPIDFile=/usr/local/ts3/ts3server.pidRestartSec=15Restart=always[Install]WantedBy=multi-user.targetYou’ll then need to add the following symbolic link:ln -s /usr/lib/systemd/system/ts3server.service /etc/systemd/system/multi-user.target.wants/ts3server.service
You can now start TeamSpeak with the command /bin/systemctl start ts3server.service

A good practice for server security would be to restrict SSH connections to authorised users only in the /etc/ssh/sshd_config file. This is done with the AllowUsers line. If you only want to allow the user crown to access your server, you would add this line to the file:AllowUsers crown
By default, AWS instances use PasswordAuthentication no so you will need an SSH key to log in.
You could also change the default SSH port from tcp/22 to something else so that all the automated scripts on the internet that try to find and break into servers won’t hit yours. If you want to do so, select a new port, add it to the Security Group in the AWS console, then you can edit the /etc/ssh/sshd_config file replacing 22 with that new number.

Keep in mind that this is YOUR server now, so YOU are responsible for keeping it up to date.You can check for operating system updates by using the yum update command (on this Linux distro). You will need to check the TeamSpeak downloads page for any TeamSpeak server version updates.To update the TeamSpeak server, just download the latest file per instruction #5 above, and extract the files over the old ones. Always make a backup of your ts3 directory before doing so!

That’s it! You should now be able to use the TeamSpeak client to log into your server.