需要准备:
ubuntu20.04、xshell、互联网
系统设置
由于安全等原因,不建议使用root用户运行teamspeak,_如果需要直接使用 root 用户,请跳过_
新建用户
代码语言:javascript复制useradd -m teamspeak
创建密码
代码语言:javascript复制passwd teamspeak
登录teamspeak账户
代码语言:javascript复制su - teamspeak
服务端安装
到Teamspeak官网下载服务端(注:非国内的ts1,ts1为盗版
方法一
下载服务端后直接将文件拖入xshell内
方法二
代码语言:javascript复制wget https://files.teamspeak-services.com/releases/server/3.13.6/teamspeak3-server_linux_amd64-3.13.6.tar.bz2
解压
代码语言:javascript复制tar -xjvf teamspeak3-server_linux_amd64-3.13.6.tar.bz2
创建teamspeak文件夹并将解压后的文件移动
代码语言:javascript复制mkdir teamspeak
mv teamspeak3-server_linux_amd64/* teamspeak
rm -rf teamspeak3-server_linux_amd64
cd teamspeak
同意许可协议
代码语言:javascript复制touch .ts3server_license_accepted
启动服务端
代码语言:javascript复制./ts3server_startscript.sh start
下面是重点
代码语言:javascript复制------------------------------------------------------------------
------------------------------------------------------------------
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用户
代码语言:javascript复制exit
放行端口
代码语言:javascript复制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
服务商防火墙同样需要放行
设置开机自启
方法一
代码语言:javascript复制vim /etc/rc.local
按i,在最后添加一行
代码语言:javascript复制/home/teamspeak/teamspeak/ts3server_startscript.sh start
按esc然后输入:wq保存退出 最后重启服务器,teamspeak就自行启动了
方法二
代码语言:javascript复制vim /lib/systemd/system/teamspeak.service
代码语言:javascript复制[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
代码语言:javascript复制systemctl daemon-reload
开启自启动(可选)
代码语言:javascript复制systemctl enable teamspeak.service
启动 TeamSpeak
代码语言:javascript复制systemctl start teamspeak.service
停止 TeamSpeak
代码语言:javascript复制systemctl stop teamspeak.service
重启 TeamSpeak
代码语言:javascript复制systemctl restart teamspeak.service
客户端设置
左上角连接 输入服务器IP和自己的昵称,连接进入 输入刚刚复制的
代码语言:javascript复制token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
之后你就获得teamspeak服务器的管理权限了
参考:TeamSpeak 服务器搭建方法