3

如何在我的Ubuntu 12.04上安装Turn服务器?你可以分享教程吗?我读了这个Implementing our own STUN/TURN server for WebRTC Application教程。但我不明白,我如何安装转我的Ubuntu的12.04服务器?在Ubuntu上为WebRTC安装Turn服务器

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

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

+2

这表示实际上试图安装一个简单的转服务器最小的努力.... – 2014-09-01 19:24:58

回答

15

它很容易安装在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更多细节和配置。

现在你可以使用TURN服务器在您的WebRTC应用为:

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

是否有可能与TCP工作?或者它只是UDP的炒作。 – sureshkumar 2017-06-03 05:05:00

+0

是的,只能使用TCP工作,但担心性能可能不好 – mido 2017-06-05 12:50:41

相关问题