注册 登录
n/vps · 2024-08-17 · 393 次浏览
u/apoloy白银
n/vpsu/apoloy · 2024-08-17

TeamSpeak服务器创建及分销

TAG:TeamSpeak,Docker,Linux

## 0.相关链接

~~TeamSpeak Image
~~TeamSpeak Server Support Articles

## 1.1使用官方License分销

### 1.1.1创建Docker 容器

docker-compose.yml

```
version: '3.1'
services:
teamspeak:
image: teamspeak:latest
restart: always
ports:
- 11771:9987/udp       #TS Virtual Server 1
- 11772:9988/udp       #TS Virtual Server 2
- 11773:9989/udp       #TS Virtual Server 3
- 11774:10011             #TS Telnet(Query)
- 11775:30033             #TS File Transfer
environment:
TS3SERVER_DB_PLUGIN: ts3db_mariadb
TS3SERVER_DB_SQLCREATEPATH: create_mariadb   #Default
TS3SERVER_DB_HOST: db    #Database Container
TS3SERVER_DB_USER: root
TS3SERVER_DB_PASSWORD: p4s5w0rd
TS3SERVER_DB_NAME: tsdb
TS3SERVER_DB_WAITUNTILREADY: 30
TS3SERVER_LICENSE: accept
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: p4s5w0rd
MYSQL_DATABASE: tsdb   #Create First Database if not exists
volumes:
- ./db_data:/var/lib/mysql  #Keep
```

logs:

> teamspeak-1 | ------------------------------------------------------------------
teamspeak-1 | I M P O R T A N T
teamspeak-1 | ------------------------------------------------------------------
teamspeak-1 | Server Query Admin Account created
teamspeak-1 | loginname= "serveradmin", password= "P87zTcjO"
teamspeak-1 | apikey= "BABnS3843r577rAr6zBZa_X0LOwQ4dsltgFziri"
teamspeak-1 | ------------------------------------------------------------------
...
teamspeak-1 | ------------------------------------------------------------------
teamspeak-1 | I M P O R T A N T
teamspeak-1 | ------------------------------------------------------------------
teamspeak-1 | ServerAdmin privilege key created, please use it to gain
teamspeak-1 | serveradmin rights for your virtualserver. please
teamspeak-1 | also check the doc/privilegekey_guide.txt for details.
teamspeak-1 |
teamspeak-1 | token=ocPbJRzgGbzBGUouLIvM6YRayRbU0jbSAKCFIUOH
teamspeak-1 | ------------------------------------------------------------------

保存Server Query Loginname和password用于管理服务器
保存token=ocPbJRzgGbzBGUouLIvM6YRayRbU0jbSAKCFIUOH用于为Virtual Server 1管理员用户授权

### 1.1.2.创建虚拟服务器

~~</s>telnet {ip/domain} {telnet_port}<e>

> TS3
Welcome to the TeamSpeak 3 ServerQuery interface, type "help" for a list of commands and "help <command>" for information on a specific command.

######~~ ~~~~本节命令:

> login | authenticate with the server
servercreate | create a virtual server
serverdelete | delete a virtual server
serveredit | change virtual server properties
serverinfo | display virtual server properties
serverlist | list virtual servers

~~</s>login serveradmin P87zTcjO<e>
</s>serverlist<e>

> virtualserver_id=1 virtualserver_port=9987 virtualserver_status=online virtualserver_clientsonline=0 virtualserver_queryclientsonline=0 virtualserver_maxclients=32 virtualserver_uptime=502 virtualserver_name=TeamSpeak\s]I[\sServer virtualserver_autostart=1 virtualserver_machine_id

id=1是默创建的vs,内部端口9987
下面演示创建一个新的vs
</s>help servercreate<e>

Usage: servercreate virtualserver_name={serverName}
[virtualserver_properties...]

Permissions:
  b_virtualserver_create

Description:
  Creates a new virtual server using the given properties and displays its ID,
  port and initial administrator privilege key. If `virtualserver_port` is not
  specified, the server will test for the first unused UDP port.
  The first virtual server will be running on UDP port 9987 by default.
  Subsequently started virtual servers will be running on increasing UDP port
  numbers.
  For detailed information, see Virtual Server Properties.

Parameters:
  virtualserver_name : name of the new virtual server
  virtualserver_welcomemessage : 
  virtualserver_maxclients : The maximum number of clients
  virtualserver_password : The connection password to use
  virtualserver_codec_encryption_mode : 
  virtualserver_encryption_ciphers : 
  virtualserver_hostmessage : 
  virtualserver_hostmessage_mode : 
  virtualserver_default_server_group : The default server group to use
  virtualserver_default_channel_group : The default channel group to use
  virtualserver_hostbanner_url : 
  virtualserver_hostbanner_gfx_url : 
  virtualserver_hostbanner_gfx_interval : 
  virtualserver_weblist_enabled : integer : 1 to report to the weblist
  virtualserver_maxclients : integer : number of max clients to accept
  virtualserver_port : The port to run the server on
  virtualserver_machine_id : 
  virtualserver_autostart : integer : 1 to autostart the server, 0 otherwise
  
Example:
  servercreate virtualserver_name=TeamSpeak\s]\p[\sServer virtualserver_port=9988 virtualserver_maxclients=32
  sid=2 virtualserver_port=9988 token=eKnFZQ9EK7G7MhtuQB6+N2B1PNZZ6OZL3ycDp2OW
  error id=0 msg=ok
<e>```</e>
创建一个基本参数port=9998(如果缺省则为9987+n),maxclients=12,password=gGbzB的vs
<C>~~`</s>servercreate virtualserver_name=TeamSpeak\sVS\s2 virtualserver_port=9988 virtualserver_maxclients=12 virtualserver_password=gGbzB virtualserver_autostart=1<e>`</e></C> 
因为我是穷b没有license到这一步就寄了


##~~ 1.2多teamspeak容器复用数据库方案

database/docker-compose.yml

~~```~~
version: '3.1'

services:
  db:
    image: mariadb
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: p4s5w0rd
      MYSQL_DATABASE: tsdb
    volumes:
      - ./db_data:/var/lib/mysql  # Keep
    networks:
      ts_net:
        ipv4_address: 172.18.0.2

networks:
  ts_net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.18.0.0/16
          gateway: 172.18.0.1
<e>```</e>
创建docker network ts_net,使用bridge,网段172.18/16,db容器分配0.2


ts0/docker-compose.yml

~~```~~
version: '3.1'
services:
teamspeak:
image: teamspeak:latest
restart: always
ports:
- 11771:9987/udp       #TS Virtual Server
- 11772:10011             #TS Telnet(Query)
- 11773:30033             #TS File Transfer
environment:
TS3SERVER_DB_PLUGIN: ts3db_mariadb
TS3SERVER_DB_SQLCREATEPATH: create_mariadb   #Default
TS3SERVER_DB_HOST: 172.18.0.2    #Database Container IP
TS3SERVER_DB_USER: root
TS3SERVER_DB_PASSWORD: p4s5w0rd
TS3SERVER_DB_NAME: tsdb0 # Database 0
TS3SERVER_DB_WAITUNTILREADY: 30
TS3SERVER_LICENSE: accept
networks:
db_ts_net:
ipv4_address: 172.18.1.0  # TS 0 IP

networks:
  db_ts_net:
    external: true
<e>```</e>

启动容器前先进入mariadb容器创建数据库
<C>~~`</s>mariadb -p<e>`</e></C>
<C>`</s>{password}<e>`</e></C>
<C>`</s>CREATE DATABASE tsdb0;<e>`</e></C>
<C>`</s>SHOW DATABASES;<e>`</e></C>
<C>`</s>exit<e>`</e></C>


创建其他ts容器需要修改的地方:


<LIST type="decimal">
- 1.~~ ports

- ~~2.~~ TS3SERVER_DB_NAME

- ~~3.~~ ipv4_address</LIST>

~~##~~ 2.管理已存在的Virtual Server

参考1.1.2连接Server Query

~~######~~ *~~_~~本节命令:<e>_</e>*

<QUOTE>*&gt;* serveredit                  | change virtual server properties
</QUOTE>



<C>~~`</s>helpserveredit<e>`</e></C>

```~~
Usage: serveredit [virtualserver_properties...]
...
Description:
Changes the selected virtual servers configuration using given properties. 
Note that this command accepts multiple properties which means that you're
able to change all settings of the selected virtual server at once.
For detailed information, see Virtual Server Properties.

Parameters:
  virtualserver_name : The name of the virtual server
  virtualserver_port : UDP port the virtual server is listening on
  virtualserver_autostart : `1` if started automatically with the instance, or `0` otherwise
  virtualserver_status : Status of the virtual server (online | virtual online | offline | booting up | shutting down)
  virtualserver_log_client : Indicates whether the server logs events related to clients or not
  virtualserver_log_query : Indicates whether the server logs events related to ServerQuery clients or not
  virtualserver_log_channel : Indicates whether the server logs events related to channels or not
  virtualserver_log_permissions : Indicates whether the server logs events related to permissions or not
  virtualserver_log_server : Indicates whether the server logs events related to server changes or not
  virtualserver_log_filetransfer : Indicates whether the server logs events related to file transfers or not
  virtualserver_min_client_version : Minimal desktop client version required to connect
  virtualserver_min_android_version : Minimal Android client version required to connect
  virtualserver_min_ios_version : Minimal iOS client version required to connect
  virtualserver_needed_identity_security_level : Minimum client identity security level required to connect to the virtual server
  virtualserver_name_phonetic : Phonetic name of the virtual server
  virtualserver_icon_id : CRC32 checksum of the virtual server icon
  virtualserver_reserved_slots : Number of reserved slots available on the virtual server
  virtualserver_weblist_enabled : Indicates whether the server appears in the global web server list or not
  virtualserver_codec_encryption_mode : The global codec encryption mode of the virtual server
  virtualserver_maxclients : integer : The maximum number of clients to allow
  virtualserver_welcomemessage : The welcome message of the server
  virtualserver_password : The password required to enter
  virtualserver_hostmessage : The host message of the server
  virtualserver_hostmessage_mode : The host message mode of the server (`0` for None, `1` for message in chatlog, `2` for message as a modal, `3` for modal dialog and then quit)
  virtualserver_default_server_group : The default server group to use 
  virtualserver_default_channel_group : The default channel group to use
  virtualserver_default_channel_admin_group : The default channel administrator group to use
  virtualserver_max_download_total_bandwidth : The max bandwidth for outgoing file transfers on the virtual server (Bytes/s)
  virtualserver_max_upload_total_bandwidth : The max bandwidth for incoming file transfers on the virtual server (Bytes/s)
  virtualserver_download_quota : Download quota for the virtual server (MByte)
  virtualserver_upload_quota : Upload quota for the virtual server (MByte)
  virtualserver_hostbanner_mode : The display mode for the virtual servers hostbanner 
  virtualserver_hostbanner_url : URL for the host banner
  virtualserver_hostbanner_gfx_url : URL for the host banner image
  virtualserver_hostbanner_gfx_interval : Refresh time for the host banner image on the client side
  virtualserver_complain_autoban_count : The number of complaints about a client we will tolerate before a ban
  virtualserver_complain_autoban_time : The amount of time (in seconds) an autobanned client will be banned for
  virtualserver_complain_remove_time : The amount of time (in seconds) before a complaint is deleted automatically
  virtualserver_min_clients_in_channel_before_forced_silence : Number of clients in the same channel needed to force silence
  virtualserver_priority_speaker_dimm_modificator : Client volume lowered automatically while a priority speaker is talking
  virtualserver_antiflood_points_tick_reduce : Anti-flood points removed from a client for being good
  virtualserver_antiflood_points_needed_command_block : Anti-flood points needed to block commands being executed by the client
  virtualserver_antiflood_points_needed_plugin_block : Anti-flood points needed to block plugin commands from the client; if set to 0, the same as virtualserver_antiflood_points_needed_command_block is used
  virtualserver_antiflood_points_needed_ip_block : Anti-flood points needed to block incoming connections from the client
  virtualserver_hostbutton_tooltip : Text used for the tooltip of the host button on client-side
  virtualserver_hostbutton_gfx_url : URL for the host button on client-side
  virtualserver_hostbutton_url : URL opened on click on the host button

Example:
  serveredit virtualserver_name=TeamSpeak\s]\p[\sServer virtualserver_maxclients=32
  error id=0 msg=ok
<e>```</e>
常用参数

<QUOTE>*&gt;* virtualserver_name : The name of the virtual server
virtualserver_port : UDP port the virtual server is listening on
virtualserver_maxclients : integer : The maximum number of clients to allow
virtualserver_welcomemessage : The welcome message of the server
virtualserver_password : The password required to enter
virtualserver_download_quota : Download quota for the virtual server (MByte)
virtualserver_upload_quota : Upload quota for the virtual server (MByte)
</QUOTE>

选中VS(id):
<C>`</s>use 1<e>`</e></C>
修改名称,密码,最大客户端数
<C>`</s>serveredit virtualserver_name=TS\sServer\s0 virtualserver_maxclients=12 virtualserver_password=password<e>`</e></C>
</r>
0
1
登录后参与讨论。

1 条回复

排序
  1. James 💯 传奇 MANAGER 2024-08-17 #2

    不知道干嘛的,反正排版看着很舒服。

    0