Loading

为WebRTC 应用部署Turn Server

 更多内容 https://www.webrtc-experiment.com/docs/TURN-server-installation-guide.html#centos

从 http://turnserver.open-sys.org/downloads/  下载最新版对应你的操作系统的Turnserver  服务器安装包

下载后解压 使用以下命令安装 rpm包 

rpm -ivh turnserver-xxxx.rpm

如遇缺少权限 使用 su root 输入密码即可 

中途遇到缺少依赖包的问题,使用 yum insatall 安装相应的包即可

 

 

编辑配置文件

将extra 中的配置文件模版拷贝到/etc目录下,假设您的ip 是 1.2.3.4

1,配置文件

cp extra/turnserver.conf.template  /etc/turnserver.conf

vi /etc/tunserver.conf

修改

 listen_address = { "1.2.3.4" }

修改 ## Daemon mode.
daemon = true # 修改为后台服务方式

修改带宽限制

## Allocation bandwidth limitation (in KBytes/s).
## 0 value means bandwidth quota disabled.
bandwidth_per_allocation = 1024


## Restricted user bandwidth (in KBytes/s).
## 0 value means bandwidth limitation disabled.
restricted_bandwidth = 0

2,认证用户文件

cp extra/turnusers.txt.template /etc/turnusers.txt

vi /etc/turnusers.txt
 
添加一行或多行认证信息格式为    用户名:密码:domain:authorized
例如下面的行:
700:700pass:domain.org:authorized
 
启动服务
$ turnserver -c /path/to/config/file #这里是配置文件地址
 
添加完成后,就可以在webrtc 里面使用stun 和tun server 了。
var configuration = {
  'iceServers': [
    { 'url' : 'stun:1.2.3.4'} ,

    { 'url' : ‘turn:700@1.2.3.4',credential : '700pass'}
  ]
};

 
 
  
 
posted @ 2016-11-03 09:45  韩严重  阅读(1198)  评论(0编辑  收藏  举报