需要准备:

ubuntu20.04、xshell、互联网

系统设置

由于安全等原因,不建议使用root用户运行teamspeak,_如果需要直接使用 root 用户,请跳过_

新建用户

useradd -m teamspeak

创建密码

passwd teamspeak

登录teamspeak账户

su - teamspeak

服务端安装

Teamspeak官网下载服务端(注:非国内的ts1,ts1为盗版

方法一

下载服务端后直接将文件拖入xshell内

方法二
wget https://files.teamspeak-services.com/releases/server/3.13.6/teamspeak3-server_linux_amd64-3.13.6.tar.bz2

解压

tar -xjvf teamspeak3-server_linux_amd64-3.13.6.tar.bz2

创建teamspeak文件夹并将解压后的文件移动

mkdir teamspeak
mv  teamspeak3-server_linux_amd64/* teamspeak
rm -rf teamspeak3-server_linux_amd64
cd teamspeak

同意许可协议

touch .ts3server_license_accepted

启动服务端

./ts3server_startscript.sh start
下面是重点
------------------------------------------------------------------
------------------------------------------------------------------
                      I M P O R T A N T                           
------------------------------------------------------------------
               Server Query Admin Account created                 
         loginname= "serveradmin", password= "xxxxxxxx"
         apikey= "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
------------------------------------------------------------------

------------------------------------------------------------------
                  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=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
------------------------------------------------------------------

启动后会出现上方的内容,复制下来,后面会用到
Ctrl+C结束服务端进程

返回root用户

exit

放行端口

iptables -A INPUT -p udp --destination-port 9987 -j ACCEPT
iptables -A INPUT -p tcp --dport  10011 -j ACCEPT
iptables -A INPUT -p tcp --dport  30033 -j ACCEPT

服务商防火墙同样需要放行

设置开机自启

方法一

vim /etc/rc.local

按i,在最后添加一行

/home/teamspeak/teamspeak/ts3server_startscript.sh start

按esc然后输入:wq保存退出
最后重启服务器,teamspeak就自行启动了

方法二

vim /lib/systemd/system/teamspeak.service
[Unit]
Description=Teamspeak Service
Wants=network.target

[Service]
WorkingDirectory=/home/teamspeak
User=teamspeak
ExecStart=/home/teamspeak/teamspeak/ts3server_minimal_runscript.sh
ExecStop=/home/teamspeak/teamspeak/ts3server_startscript.sh stop
ExecReload=/home/teamspeak/teamspeak/ts3server_startscript.sh restart
Restart=always
RestartSec=15
 
[Install]
WantedBy=multi-user.target

重新加载 systemd

systemctl daemon-reload

开启自启动(可选)

systemctl enable teamspeak.service

启动 TeamSpeak

systemctl start teamspeak.service

停止 TeamSpeak

systemctl stop teamspeak.service

重启 TeamSpeak

systemctl restart teamspeak.service

客户端设置

左上角连接
输入服务器IP和自己的昵称,连接进入
输入刚刚复制的

token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

之后你就获得teamspeak服务器的管理权限了

参考:TeamSpeak 服务器搭建方法

最后修改:2022 年 08 月 02 日
如果觉得我的文章对你有用,请随意赞赏