TeamSpeak3语音服务器部署手册
服务器配置要求较低,2M带宽可以负载32人在线。内存和CPU按照1U1G最低需求配置即可。
服务器操作系统:Centos7
服务器包下载:https://teamspeak.com/zh-CN/downloads/#server
服务器图标:https://tsicons.com/
下载选择Linux 64-BIT
或本地下载传输给服务器,或服务器直接使用以下命令下载:
[root@cd3 ~]# wget https://files.teamspeak-services.com/releases/server/3.13.6/teamspeak3-server_linux_amd64-3.13.6.tar.bz2
将下载文件解压,并进入路径:
[root@cd3 ~]# tar xf teamspeak3-server_linux_amd64-3.13.6.tar.bz2 [root@cd3 ~]# cd teamspeak3-server_linux_amd64/ [root@cd3 teamspeak3-server_linux_amd64]#
启动服务器(此处报错,需要授权)
[root@cd3 teamspeak3-server_linux_amd64]# ./ts3server_startscript.sh start WARNING ! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT !!!!!!!!!!! Starting the TeamSpeak 3 server Please set the environment variable TS3SERVER_LICENSE to "accept" in order to accept the license agreement. Alternatively, create a file named ".ts3server_license_accepted" in the working directory or start the server with the command line parameter "license_accepted=1". To view the license agreement set TS3SERVER_LICENSE to "view" in order to print the license to the console. Alternatively view the file "LICENSE" in your favorite text viewer yourself. TeamSpeak 3 server could not start
根据报错提示在本路径下创建授权文件:
[root@cd3 teamspeak3-server_linux_amd64]# touch .ts3server_license_accepted
再次启动:
[root@cd3 teamspeak3-server_linux_amd64]# ./ts3server_startscript.sh start WARNING ! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT !!!!!!!!!!! Starting the TeamSpeak 3 server TeamSpeak 3 server started, for details please view the log file [root@cd3 teamspeak3-server_linux_amd64]# ------------------------------------------------------------------ I M P O R T A N T ------------------------------------------------------------------ Server Query Admin Account created loginname= "serveradmin", password= "f0pmfbqy" apikey= "BACpV-CVmbquJwwWJIc9jvKgiOl5Rq97M7H3rvr" ------------------------------------------------------------------ ------------------------------------------------------------------ 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=vP0auTRmcC8nb3rMY9fqyi6+TK3mtX3NempuOEAy ------------------------------------------------------------------
程序将会自动进入后台,保存以上信息即可退出服务器,以上信息的token参数为Server Admin用户授权码,方便用户管理,首次进入后根据提示填入此token即可使用。
注意!此token只能绑定一个账户,只能使用一次!
检查服务器端口信息:
[root@cd3 teamspeak3-server_linux_amd64]# netstat -untlp |grep ts tcp 0 0 0.0.0.0:10080 0.0.0.0:* LISTEN 6983/./ts3server tcp 0 0 0.0.0.0:10022 0.0.0.0:* LISTEN 6983/./ts3server tcp 0 0 0.0.0.0:30033 0.0.0.0:* LISTEN 6983/./ts3server tcp 0 0 0.0.0.0:10011 0.0.0.0:* LISTEN 6983/./ts3server tcp6 0 0 :::10080 :::* LISTEN 6983/./ts3server tcp6 0 0 :::10022 :::* LISTEN 6983/./ts3server tcp6 0 0 :::30033 :::* LISTEN 6983/./ts3server tcp6 0 0 :::10011 :::* LISTEN 6983/./ts3server udp 0 0 0.0.0.0:9987 0.0.0.0:* 6983/./ts3server udp6 0 0 :::9987 :::* 6983/./ts3server
如果有按端口设置防火墙需求的,可按此输出信息开放防火墙。
9987为语音主要通讯端口。
30033为文件或图标传输端口。
在以上的服务器输出信息中,存在此信息:
loginname= "serveradmin", password= "f0pmfbqy" apikey= "BACpV-CVmbquJwwWJIc9jvKgiOl5Rq97M7H3rvr"
此信息是通过telnet方式登录服务器管理和API接口调用使用的,其telnet登录端口为10011
telnet可通过以下命令登录:
[root@cd3 ~]# telnet 10.0.0.3 10011 Trying 10.0.0.3... Connected to 10.0.0.3. Escape character is '^]'. TS3 Welcome to the TeamSpeak 3 ServerQuery interface, type "help" for a list of commands and "help <command>" for information on a specific command. help TeamSpeak 3 Server :: ServerQuery (c) TeamSpeak Systems GmbH ServerQuery is a command-line interface built into the TeamSpeak 3 Server which allows powerful scripting and automation tools to be built based on the exact same instruction set and functionality provided by the TeamSpeak 3 Client. For example, you can use scripts to automate the management of virtual servers or nightly backups. In short, you can perform operations more efficiently by using ServerQuery scripts than you can by using a user interface. Command Overview: apikeyadd | create a apikey apikeydel | delete a apikey apikeylist | list apikeys banadd | create a ban rule banclient | ban a client bandel | delete a ban rule bandelall | delete all ban rules banlist | list ban rules on a virtual server bindinglist | list IP addresses used by the server instance channeladdperm | assign permission to channel 以下略。。。
登录后无命令提示符,可输入help查看命令操作手册。
ts3服务器命令行操作,官方对于此类操作手册较少。需要通过help命令进一步查询手册使用。
例如使用help查询login命令用法,输出内容有时会输出\s,此字符可理解为空格符。:
help login Usage: login client_login_name={username} client_login_password={password} login {username} {password} Permissions: b_serverquery_login Description: Authenticates with the TeamSpeak 3 Server instance using given ServerQuery login credentials. Example: login client_login_name=xyz client_login_password=xyz error id=0 msg=ok
若Server Admin权限丢失,理论上可通过此telnet远程方式生成token
以下部分内容引用自(写的很全):https://blog.starryvoid.com/archives/1046.html
一台服务器环境内的多TS操作(利用docker)
安装docker环境以及images拉取的环节在此处跳过,直接进入docker使用。(docker安装可参考https://teddyou.com/?id=89)
先在本地复制多个ts目录。(步骤略)
[root@cd1 ~]# cd /home/docker/ [root@cd1 docker]# ll 总用量 12 drwxrwxrwx 10 root root 4096 12月 19 01:03 1997 drwxrwxrwx 10 root root 4096 12月 19 01:07 2050 drwxrwxrwx 10 root root 4096 12月 19 00:47 2060
为了区分,这里的文件夹以端口号命名。
进入其中一个文件夹,用以下命令生成ts3配置文件
./ts3server createinifile=1
修改配置文件的(文件图标传输端口,操作错误将会导致服务器图标加载异常和文件传输异常);防止端口冲突
filetransfer_port=30034
说明:此处并未测试不修改此端口是否能够通讯(并未测试和了解服务通讯逻辑),因为我初步怀疑此端口号是由9987UDP服务端口告知客户端需要连接到TCP端口;所以怀疑如果此处不做修改将会传输混乱,也可能什么都不会发生。
启动容器
docker run -t -p 2050:9987/udp -p 30034:30034/tcp -v /home/docker/2050:/ts3server -d 667feef757d1
docker命令注释:
-p 端口映射关系
-v 映射物理机文件夹到虚拟机
-d image ID
进入容器(docker ps 可查询容器ID)
docker exec -it e67645af1 /bin/bash
启动容器中的ts3
cd /ts3server ./ts3server_startscript.sh start inifile=ts3server.ini
说明一下:
配置文件的以下行不建议修改,因为通过日志查询,最终启动的UDP端口还是9987
default_voice_port=9987
连接TS3服务器时,以UDP通讯端口为准。
例如按照以上方法配置的服务器地址应该填写为:x.x.x.x:2050
关于TS服务器的版本升级
直接通过tar xf解压覆盖,或解压后cp覆盖重启即可,替换文件一般不会影响现有数据;但为了保险起见建议在更新前备份。
发表评论