TURN installation on CentOS - xpush/messengerX GitHub Wiki

TURN installation on CentOS

1. Install Prerequisite for CentOS

$ yum install -y make gcc cc gcc-c++ wget
$ yum install -y openssl-devel libevent libevent-devel mysql-devel mysql-server

2. Download & Install LibEvent modules

$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
$ tar xvfz libevent-2.0.21-stable.tar.gz
$ cd libevent-2.0.21-stable && ./configure
$ make && make install && cd ..

you can use "sudo" if permission-denied kind of erros occurred. sudo make && sudo make install && cd ..

3. Download & Install TURN modules

$ wget http://turnserver.open-sys.org/downloads/v3.2.4.2/turnserver-3.2.4.2.tar.gz
$ tar -xvzf turnserver-3.2.4.2.tar.gz
$ cd turnserver-3.2.4.2 && ./configure
$ make && make install && cd ..
1) If you system supports automatic start-up system daemon services,
the, to enable the turnserver as an automatically started system
service, you have to:

	a) Create and edit /etc/turnserver.conf or
	/usr/local/etc/turnserver.conf .
	Use /usr/local/etc/turnserver.conf.default as an example.

	b) For user accounts settings, if using the turnserver
	with authentication: create and edit /etc/turnuserdb.conf
	file, or set up PostgreSQL or MySQL or Redis database for user accounts.
	Use /usr/local/etc/turnuserdb.conf.default as example for flat file DB,
	or use /usr/local/share/turnserver/schema.sql as SQL database schema,
	or use /usr/local/share/turnserver/schema.userdb.redis as Redis
	database schema description and/or /usr/local/share/turnserver/schema.stats.redis
	as Redis status & statistics database schema description.

	c) add whatever is necessary to enable start-up daemon for the /usr/local/bin/turnserver.

2) If you do not want the turnserver to be a system service,
   then you can start/stop it "manually", using the "turnserver"
   executable with appropriate options (see the documentation).

3) To create database schema, use schema in file /usr/local/share/turnserver/schema.sql.

4) For additional information, run:

   $ man turnserver
   $ man turnadmin
   $ man turnutils

5. Run turnserver

Finally, for this relatively simple case that uses a system with a single Ethernet NIC and IP addres and no NAT firewall, start the TURN server with:

> turnserver -L <public_ip_address> -a -b turnuserdb.conf -f -r <system_domain_name>

Or, start it as a Linux daemon with:

> turnserver -L <public_ip_address> -o -a -b turnuserdb.conf -f -r <system_domain_name>

The TURN server should now be ready to use for media relay when ICE decides that it is needed for a WebRTC connection.