Teamspeak Server Installation

From Scottworld
Jump to navigation Jump to search

First, create a new user with your desired name, we will use the name "teamspeak" for this guide.

adduser --disabled-login teamspeak

Get the latest TeamSpeak 3 server files for 64-bit Linux. Check their website, a new version may be available. https://teamspeak.com/en/downloads/#server

wget http://dl.4players.de/ts/releases/3.2.0/teamspeak3-server_linux_amd64-3.2.0.tar.bz2

Extract the archive.

tar xvf teamspeak3-server_linux_amd64-3.2.0.tar.bz2

Move the extracted files to the teamspeak install directory then remove the extracted folder and downloaded archive.

cd teamspeak3-server_linux_amd64 && mv * /opt/teamspeak && cd .. && rm teamspeak3*

Change ownership of the TeamSpeak 3 server files.

chown -R teamspeak:teamspeak /opt/teamspeak

Make the TeamSpeak 3 server start on boot. Use your favourite editor to make a new file called teamspeak.service in /etc/systemd/system/.

nano /etc/systemd/system/teamspeak.service
[Unit]
Description=TeamSpeak 3 Server
After=network.target

[Service]
WorkingDirectory=/home/teamspeak/
User=teamspeak
Group=teamspeak
Type=forking
ExecStart=/opt/teamspeak/ts3server_startscript.sh start inifile=ts3server.ini
ExecStop=/opt/teamspeak/ts3server_startscript.sh stop
PIDFile=/opt/teamspeak/ts3server.pid
RestartSec=15
Restart=always

[Install]
WantedBy=multi-user.target


Once you are done, save the file and close the editor. Now we will activate the script so that it will start on boot. This makes to systemd recognize the file we just created.

systemctl --system daemon-reload


Enable the service.

systemctl enable teamspeak.service

Start the TeamSpeak server.

systemctl start teamspeak.service

Once you've started the server, you can check that it's running with this command.

systemctl status teamspeak.service

When you first try to connect to your TeamSpeak server, you may be prompted to use a privilege key. This privilege key allows to administrate your TeamSpeak server. To get this privilege key, use the following command:

cat /opt/teamspeak/logs/ts3server_*

A t bottom you'll see something that looks like this:

--------------------------------------------------------
ServerAdmin privilege key created, please use the line below
token=****************************************
--------------------------------------------------------

Replace the stars with your unique token, and enter it into your TeamSpeak client. You'll see a prompt telling you that the privilege key was successfully used.



If the server fails to start as a non-root user

Run an "ls -al /dev/shm/" and if there's a filename called "7gbhujb54g8z9hu43jre8" with the root user as the owner, then you delete the file, before starting the TeamSpeak server again with your non-root user.

It should then start okay and when you run the "ls" command again you'll see that the file has been re-created with the owner as the non-root user.