您的位置 首页 Ubuntu

视频流 – 在Ubuntu上为WebRTC安装TURN服务器

如何在我的ubuntu 12.04上安装TURN服务器?你能分享教程吗?我读了这个教程:
Implementing our own STUN/TURN server for WebRTC Application.但我不明白的是如何在我的ubuntu 12.04上安装自己的TURN服务器?

我正在使用类似以下代码的东西来创建RTCPeerConnection

const pc_config = {"iceServers": [{"url": "stun:stun.l.google.com:19302"},{"url":"turn:my_username@<turn_server_ip_address>","credential":"my_password"}]};

const pc_new = new webkitRTCPeerConnection(pc_config);

我想填写上面代码的参数来使用不同的网络.

当我想安装转服务器然后我得到

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package resiprocate-turn-server

我使用了apt-get install resiprocate-turn-server.我也使用了这个https://www.webrtc-experiment.com/docs/TURN-server-installation-guide.html教程.

它很容易在linux机器上安装,而不是在其他操作系统中尝试过.

简单方法:

sudo apt-get install coturn

如果你说不,我想要最新的前沿,你可以自己安装它的downloads page下载源代码,例如:

sudo -i     # ignore if you already in admin mode
apt-get update && apt-get install libssl-dev libevent-dev libhiredis-dev make -y    # install the dependencies
wget -O turn.tar.gz http://turnserver.open-sys.org/downloads/v4.5.0.3/turnserver-4.5.0.3.tar.gz     # Download the source tar
tar -zxvf turn.tar.gz     # unzip
cd turnserver-*
./configure
make && make install

用于运行TURN服务器的示例命令:

sudo turnserver -a -o -v -n  --no-dtls --no-tls -u test:test -r "someRealm"

命令说明:

> -a – 使用长期凭证机制
> -o – 将服务器进程作为守护进程运行
> -v – ‘中等’详细模式.
> -n – 没有配置文件
> –no-dtls – 不要启动DTLS侦听器
> –no-tls – 不要启动TLS监听器
> -u – 要使用的用户凭据
> -r – 要使用的默认域,需要TURN REST API

请查看此wiki以获取更多详细信息和配置.

现在您可以在WebRTC应用程序中使用TURN服务器:

var peerConnectionConfig = {
  iceServers: [{
    urls: YOUR_IP:3478,username: 'test',password: 'test'
  }]
}

关于作者: dawei

【声明】:金华站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

热门文章