Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing a TURN Server on Ubuntu for WebRTC

Tags:

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?

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 

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

like image 391
Dvlpr Avatar asked Aug 28 '14 10:08

Dvlpr


People also ask

Do you need a turn server for WebRTC?

For most WebRTC applications to function a server is required for relaying the traffic between peers, since a direct socket is often not possible between the clients (unless they reside on the same local network). The common way to solve this is by using a TURN server.


1 Answers

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

simple way:

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  

sample command for running TURN server:

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

command description:

  • -a - Use long-term credentials mechanism
  • -o - Run server process as daemon
  • -v - 'Moderate' verbose mode.
  • -n - no configuration file
  • --no-dtls - Do not start DTLS listeners
  • --no-tls - Do not start TLS listeners
  • -u - user credentials to be used
  • -r - default realm to be used, need for TURN REST API

check this wiki for more details and configurations.

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

var peerConnectionConfig = {   iceServers: [{     urls: YOUR_IP:3478,     username: 'test',     password: 'test'   }] } 
like image 107
mido Avatar answered Oct 09 '22 03:10

mido