在Ubuntu上为WebRTC安装TURN服务器 [英] Installing a TURN Server on Ubuntu for WebRTC

查看:382
本文介绍了在Ubuntu上为WebRTC安装TURN服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在ubuntu 12.04上安装TURN服务器?可以分享教程吗?我阅读了本教程:为WebRTC实现我们自己的STUN/TURN服务器应用.但是我不明白的是如何在ubuntu 12.04上安装自己的TURN服务器?

How can I install a TURN server on my ubuntu 12.04? Can you share tutorial? I read this tutorial: Implementing our own STUN/TURN server for WebRTC Application. But what I don't understand is how I can I install my own TURN server on my ubuntu 12.04?

我目前正在使用类似以下代码的内容来创建RTCPeerConnection

I am using currently using something like the following code to create the 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);

我想填写以上代码的参数以与其他网络配合使用.

And I want to fill the above code's arguments to work with a different network.

当我要安装转弯服务器时,我会得到

When i want to install turn server then I get

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 教程.

I used apt-get install resiprocate-turn-server. I also used this https://www.webrtc-experiment.com/docs/TURN-server-installation-guide.html tutorial.

推荐答案

在Linux机器上很容易安装,而在其他OS上则没有尝试.

it is easy to install in linux machines, not tried in other OSes.

简单方法:

sudo apt-get install coturn

如果您拒绝,我想要最新的技术,则可以从其下载页面下载源代码自己安装,例如:

If you say no, I want the latest cutting edge, you can download source code from their downloads page in install it yourself, example:

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服务器的示例命令:

sample command for running TURN server:

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 了解更多详细信息和配置.

check this wiki for more details and configurations.

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

now you can use the TURN server in your WebRTC application as:

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

这篇关于在Ubuntu上为WebRTC安装TURN服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆