2014-08-28 133 views
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

相關問題