参考资料: https://www.wevg.org/archives/teamspeak-server-build/#fnref1
在官网下载好TeamSpeak3服务器软件
https://www.teamspeak.com/zh-CN/downloads/#server
为TeamSpeak软件单独创建一个新Linux用户并且设置好密码
# 为了保证系统的安全,不要使用 root 账户安装并配置TS服务器,除非整个系统只有这一个软件
useradd teamspeak
passwd teamspeak
将TeamSpeak3服务器软件上传至TeamSpeak用户目录下
# 通常是如下目录
cd /home/teamspeak/
# 如果只运行一个程序不需要做隔离图省事随便放也可以,通常是如下目录
cd /opt/teamspeak/
解压软件包,得到名为teamspeak3-server_linux_amd64的文件夹
tar -xvf teamspeak3-server_linux_amd64.tar.bz2
然后cd进去,创建一个名为“.ts3server_license_accepted”的文件用于同意软件许可协议
cd teamspeak3-server_linux_amd64
touch .ts3server_license_accepted
启动服务器
./ts3server_startscript.sh start
注意保存如下所显示的密钥及ServerQuery管理员账户和密码
------------------------------------------------------------------
I M P O R T A N T
------------------------------------------------------------------
Server Query Admin Account created
loginname= "serveradmin", password= "21312312312"
apikey= "23412412343242342343242342314123423412412"
------------------------------------------------------------------
------------------------------------------------------------------
I M P O R T A N T
------------------------------------------------------------------
ServerAdmin privilege key created, please use it to gain
serveradmin rights for your virtualserver. please
also check the doc/privilegekey_guide.txt for details.
token=4234123423142342343234231351353453413451
------------------------------------------------------------------
设置自启动
在/lib/systemd/system/
创建文件teamspeak.service
并将如下代码粘贴进去,注意检查一下路径是否正确
[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
之后就可以通过systemctl来控制软件开关自启动并查看状态了
systemctl daemon-reload # 重新加载systemd
systemctl enable teamspeak.service # 开启自启动
systemctl start teamspeak.service # 启动TeamSpeak
systemctl stop teamspeak.service # 停止TeamSpeak
systemctl restart teamspeak.service # 重启TeamSpeak
如果有防火墙记得添加端口放行
9987 | UDP | 默认语音服务器端口(必开) |
10011 | TCP | ServerQuery raw 端口 |
10022 | TCP | ServerQuery SSH 端口(需要 3.3.0 以上版本服务端) |
10080 | TCP | ServerQuery HTTP 端口(需要 3.12.0 以上版本服务端) |
10443 | TCP | ServerQuery HTTPS 端口(需要 3.12.0 以上版本服务端) |
30033 | TCP | 文件传输端口(可选,涉及头像图片之类的) |
41144 | TCP | TSDNS |