This content was deleted by the author. You can see it from Blockchain History logs.

Setup TURN server for WebRTC on Ubuntu

My first encounter with TURN server installation was little miserable as all the tutorials and guides found were older. I am always in search of simple and tiny guides so that I spend more time in working on other things rather than doing installations. After spending some 4 hours on TURN server installation yesterday, I decided to write this tiny guide which would come as handy in future. By following simple steps, we would install basic TURN server for WebRTC here. We would not go for authentication using database as in this post I want to keep installation as simple as possible.


We would install the rfc5766-turn-server, an open-source project, on Ubuntu. Other operating systems will be covered some other day. Meanwhile, you can follow the instructions in this guide.

Without wasting time, let's get started.


Step 1: Install the dependencies

sudo apt-get install libssl-devsudo apt-get install libevent-dev


Step 2: Download the tar file and untar it


wget http://turnserver.open-sys.org/downloads/v3.2.5.9/turnserver-3.2.5.9-debian-wheezy-ubuntu-mint-x86-64bits.tar.gz


You can download the latest version by going to the downloads section in this link: https://code.google.com/p/rfc5766-turn-server

Now, let's open it up.

tar xfz turnserver-3.2.5.9-debian-wheezy-ubuntu-mint-x86-64bits.tar.gz

You would get *.deb file and INSTALL file. I would recommend you to read the INSTALL file in your spare time but it is not required for this guide. I would suggest you external documents to read in this guide as I believe in reading and I am sure you would then understand more about these steps.

Step 3: Installation

sudo apt-get update

sudo apt-get install gdebi-core

If you get unmet dependency error on above command then run the following command before running this command.

sudo apt-get -f install

Next, we would use gdebi with *.deb file.

sudo gdebi rfc5766*.deb

It will install the TURN on your file system. It would put documentations, binaries and configuration files in different directories. You would like to read some documentation in /usr/share/doc/rfc5766-turn-server directory.

I would also suggest to check following manuals.

man turnserver

man turnadmin

man turnutils

Step 4: Configuration

You need to edit this file /etc/turnserver.conf. Edit the following lines

listening-ip=<private ip address>
relay-ip=<private ip address>
external-ip=<public ip address>
min-port=32355
max-port=65535
realm=<your domain>

Now uncomment:

lt-cred-mech
fingerprint 

We would use the long term credentials. For this, you need to edit this file /etc/turnuserdb.conf. Insert the following statement in this file.

username:password

Change the username with your username and password with your password.


Now, in order to run turn server as a daemon, edit this file /etc/default/rfc5766-turn-server and make sure following is set to 1.

TURNSERVER_ENABLED=1

Step 5: Start the server

Go to this directory /usr/bin and run the following command to start the server.

sudo /etc/init.d/rfc5766-turn-server start

Hopefully, you would see your server running. I hope this guide served its purpose. This is my first post so any suggestions and improvements are highly appreciated.