更新系统和依赖

1
2
yum -y update
yum -y install nano wget perl tar net-tools bzip2

添加用户安装TS

使用普通用户权限运行TeamSpeak,隔离ts服务端与其他系统服务

1
2
adduser teamspeak
passwd teamspeak

会提示为新建的用户设置密码,这个密码之后不会用到。

1
2
3
4
5
6
7
wget https://files.teamspeak-services.com/releases/server/3.6.0/teamspeak3-server_linux_amd64-3.11.0.tar.bz2
tar -jxf teamspeak3-server_linux_amd64-3.11.0.tar.bz2
cd teamspeak3-server_linux_amd64
cp * -R /home/teamspeak
cd ..
rm -rf teamspeak3-server_linux_amd64*
chown -R teamspeak:teamspeak /home/teamspeak

设置TS服务和防火墙

1
vi /lib/systemd/system/teamspeak.service

在打开的文件编辑器里输入

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[Unit]
Description=Team Speak 3 Server
After=network.target
[Service]
WorkingDirectory=/home/teamspeak/
User=teamspeak
Group=teamspeak
Type=forking
ExecStart=/home/teamspeak/ts3server_startscript.sh start inifile=ts3server.ini
ExecStop=/home/teamspeak/ts3server_startscript.sh stop
PIDFile=/home/teamspeak/ts3server.pid
RestartSec=15
Restart=always
[Install]
WantedBy=multi-user.target
1
:wq

保存退出

关闭防火墙

1
systemctl stop firewalld

CentOS 7 SElinux(临时关闭)

1
setenforce 0

启动TS服务

我们需要切换到teamspeak用户来启动,刚刚也说到了,teamspeak不允许使用root用户启动该应用。

切换用户并直接到该用户家目录

1
su - teamspeak

启动teamspeak3

1
./ts3server_startscript.sh start license_accepted=1

输出结果是这个样子就是成功了

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
------------------------------------------------------------------
I M P O R T A N T
------------------------------------------------------------------
Server Query Admin Account created
loginname= "serveradmin", password= "Oxxxxxx"
------------------------------------------------------------------


------------------------------------------------------------------
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=NeFUcjE0CIS3Qv2oBR2E+WsAxxxxxxxxxxxxxx
------------------------------------------------------------------

管理员客户端登陆TS服务器

启动Teamspeak3–连接–填写自己服务器地址或域名(密码我没填也能上,不确定是不是必须的)

点连接后会弹出一个秘钥输入框,输入刚生成的’token’,即可获取频道管理员权限。