电脑技术 · 2020年11月14日 0

Installing TeamSpeak Server in CentOS 7

  • First start by updating your CentOS 7 server packages and then install needed dependencies for the installation process using following commands.
# yum update
# yum install vim wget perl tar net-tools bzip2
  • Next, you need to create a user for TeamSpeak Server process to ensure that the TeamSpeak server is running in user mode detached from other processes.
# useradd teamspeak
# passwd teamspeak
  • Now go to the TeamSpeak Server download page and grab the most recent version (i.e. 3.2.0) using following wget command and then extract the tarball and copy all of the files to our unprivileged user’s home directory as shown.
# wget -c http://dl.4players.de/ts/releases/3.2.0/teamspeak3-server_linux_amd64-3.2.0.tar.bz2 
# tar -xvf teamspeak3-server_linux_amd64-3.2.0.tar.bz2 
# mv teamspeak3-server_linux_amd64 teamspeak3 
# cp -R teamspeak3 /home/teamspeak/ 
# chown -R teamspeak:teamspeak /home/teamspeak/teamspeak3/
  • Once everything in place, now switch to teamspeak user and start the teamspeak server manually using following commands.
# su - teamspeak 
$ cd teamspeak3/ 
$ ./ts3server_startscript.sh start
  • To manage TeamSpeak Server under Systemd services, you need to create a teamspeak service unit file.
$ su - 
# vi /etc/systemd/system/teamspeak.service

Add the following configuration in the unit file.

[Unit]
Description=Team Speak 3 Server
After=network.target

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

[Install]
WantedBy=multi-user.target
# systemctl start teamspeak
# systemctl enable teamspeak
# systemctl status teamspeak
  • When you start the teamspeak server for the first time, it generates a administrator token/key which you will use to connect to the server from a TeamSpeak Client. You can view the log file to get the key.
# cat /home/teamspeak/logs/ts3server_2017-08-09__22_51_25.819181_1.log
  • Next, TeamSpeak listens on a number of ports: 9987 UDP (TeamSpeak Voice service), 10011 TCP (TeamSpeak ServerQuery) and 30033 TCP (TeamSpeak FileTransfer).

Therefore modify your firewall rules to open these ports as follows.

# firewall-cmd --zone=public --add-port=9987/udp --permanent
# firewall-cmd --zone=public --add-port=10011/tcp --permanent
# firewall-cmd --zone=public --add-port=30033/tcp --permanent
# firewall-cmd --reload