仙姑本咕

Hexg's Blog

没有理想的人不伤心

TeamSpeak Server Setup Guide (Linux)

teamspeak-3.webp
On February 28, 2020, we launched our own TeamSpeak channel Alkaid Pro. After several months, let's talk about the whole process of building our TeamSpeak channel and the lessons we learned along the way.

Preparation#

To set up a private TeamSpeak server, you need the following:

  • A server
  • A domain name (optional)

Before you start, make sure your operating system is up to date. We recommend using the latest LTS version, such as Ubuntu 22.04 LTS or Debian 11.

Check your Linux Kernel version

You can use the uname -a command to check your Linux Kernel version.

System Basic Configuration#

System update

After installing the operating system, it is recommended that you open the terminal and update the system, install software updates, and system security patches.

sudo apt update && sudo apt -y upgrade && sudo apt -y install curl vim wget git sudo unzip apt-transport-https screen ca-certificates dialog softw

If you find that the download or update speed is slow, you can consider replacing the software source address used by the software by executing the following command. I personally prefer to replace it with "Beijing Foreign Studies University Open Source Software Mirror", and then execute the above command:

cat <<'EOF' > /etc/apt/sources.list

deb https://mirrors.bfsu.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.bfsu.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.bfsu.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse

EOF

After the software and system patches are updated, perform a restart to make the patches take effect (the kernel will be updated for the first update).

sudo reboot

Download TeamSpeak Server#

Go to the /opt directory.

cd /opt

Download Linux Server#

Get the latest Linux Server 64-bit server from the TeamSpeak official website and download it.

wget https://files.teamspeak-services.com/releases/server/3.13.7/teamspeak3-server_linux_amd64-3.13.7.tar.bz2

Because the quality of the TeamSpeak server's connection to mainland China is poor, slow downloads or download failures may occur. At this time, you can replace files.teamspeak-services.com with teamspeak-mirror.wevg.org (Seoul, South Korea, recommended) or files.ts.gkd.plus (optimized CDN in mainland China).

For example:

wget https://teamspeak-mirror.wevg.org/releases/server/3.13.7/teamspeak3-server_linux_amd64-3.13.7.tar.bz2

or

wget https://files.ts.gkd.plus/releases/server/3.13.7/teamspeak3-server_linux_amd64-3.13.7.tar.bz2

Extract Linux Server#

Extract and remove the TeamSpeak server compression package.

tar -xjvf teamspeak3-server_linux_amd64-3.13.7.tar.bz2 && rm teamspeak3-server_linux_amd64-3.13.7.tar.bz2

To ensure the security of the system, we usually do not use the root account to configure the TeamSpeak server, so we create a new user named "teamspeak" here.

useradd teamspeak

Grant permissions to the newly created user and enter the teamspeak directory.

chown -R teamspeak:teamspeak teamspeak3-server_linux_amd64 && cd /opt/teamspeak3-server_linux_amd64 && su teamspeak

Install Linux Server#

Before starting the server, you need to accept the license agreement.

touch .ts3server_license_accepted

Start the server.

./ts3server_startscript.sh start

Set up auto-start#

If you want the TeamSpeak server to start automatically when the system starts up, you can write a service file according to this guide. Please note that this step requires root privileges.

Create the teamspeak.service file and edit it.

vim /lib/systemd/system/teamspeak.service

Enter and save the following content in the file.

[Unit]
Description=Teamspeak, The most superior online voice communication solution.
Wants=network-online.target
After=syslog.target network.target network-online.target

[Service]
User=teamspeak
Group=teamspeak
WorkingDirectory=/opt/teamspeak3-server_linux_amd64/
ExecStart=/opt/teamspeak3-server_linux_amd64/ts3server_startscript.sh start
ExecStop=/opt/teamspeak3-server_linux_amd64/ts3server_startscript.sh stop
PIDFile=/opt/teamspeak3-server_linux_amd64/ts3server.pid
Type=forking

[Install]
WantedBy=multi-user.target

Enter :wq to exit and save.

Then reload systemd.

systemctl daemon-reload

Available commands#

At this point, you can use the following commands directly in the command line.

Enable auto-start.

systemctl enable teamspeak.service

Start TeamSpeak.

systemctl start teamspeak.service

Stop TeamSpeak.

systemctl stop teamspeak.service

Restart TeamSpeak.

systemctl restart teamspeak.service

Configure Connection#

Firewall Settings#

By default, TeamSpeak requires the following ports. Please configure the following ports in the firewall.

PortProtocolDescription
9987UDPDefault voice server port
30033TCPFile transfer port

Domain Name Settings (optional)#

In general, you can directly resolve the domain name to your server IP. However, this will expose the server's IP directly. In this case, we can bind your TeamSpeak server to a domain name using SRV records.

SRV

SRV does not support IP records, so before that, bind a subdomain to the TS server. Here, dc.hexg.me is used as an example.

TypeValue
Name_ts3._udp.ts.hexg.me
Priority5
Weight0
Port9987
Addressdc.hexg.me
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.