本文的原文连接是: http://blog.csdn.net/freewebsys/article/details/47109183 未经博主允许不得转载。

1,关于stun和turn

STUN(Simple Traversal of UDP over NATs,NAT 的UDP简单穿越)是一种网络协议,它允许位于NAT(或多重NAT)后的客户端找出自己的公网地址,查出自己位于哪种类型的NAT之后以及NAT为某一 个本地端口所绑定的Internet端端口。这些信息被用来在两个同时处于NAT 路由器之后的主机之间建立UDP通信。该协议由RFC 3489定义。目前RFC 3489协议已被RFC 5389协议所取代,新的协议中,将STUN定义为一个协助穿越NAT的工具,并不独立提供穿越的解决方案。它还有升级版本RFC 7350,目前正在完善中。
http://baike.baidu.com/view/884586.htm

TURN的全称为Traversal Using Relay NAT,即通过Relay方式穿越NAT,TURN应用模型通过分配TURNServer的地址和端口作为客户端对外的接受地址和端口,即私网用户发出的报文都要经过TURNServer进行Relay转发。
http://baike.baidu.com/subview/351571/10359693.htm

2,安装

参考:
http://www.hankcs.com/program/network/compile-rfc5766-turn-server-to-build-turn-server.html

代码下载:
https://github.com/coturn/rfc5766-turn-server/releases
下载最新的tar.gz包。rfc5766-turn-server-3.2.5.9.tar.gz

安装依赖环境

##ssl 需要yum安装
yum install openssl openssl-libs libevent libevent-devel

如果还是报错,就手动安装libevent。

centos Libevent2 development libraries are not installed properly in required location

下载:http://libevent.org/ 官网,下载
https://sourceforge.net/projects/levent/files/libevent/libevent-2.0/libevent-2.0.22-stable.tar.gz
然后解压缩编译安装即可

编译turn-server

tar -zxvf rfc5766-turn-server-3.2.5.9.tar.gz
cd rfc5766-turn-server-3.2.5.9
./configure
make
make install

configure成功:

more is /usr/bin/more
install is /usr/bin/install
pkill is /usr/bin/pkill
Use TMP dir /var/tmp
Compiler: cc
Do not use -lsocket
Do not use -lwldap32
Do not use -lwldap64
Do not use -lintl
Sockets code is fine: no sin_len field present
Ignore IP_RECVERR
Crypto SSL lib found.
SSL lib found.
Libevent2 development found.
Libevent2 runtime found.
Libevent2 openssl found.
Libevent2 pthreads found.POSTGRESQL DEVELOPMENT LIBRARY (libpq.a) AND/OR HEADER (libpq-fe.h)ARE NOT INSTALLED PROPERLY ON THIS SYSTEM.THAT'S OK BUT THE TURN SERVER IS BUILDING WITHOUT POSTGRESQL DATABASE SUPPORT.MYSQL DEVELOPMENT LIBRARY (libmysqlclient) AND/OR HEADER (mysql.h)ARE NOT INSTALLED PROPERLY ON THIS SYSTEM.THAT'S OK BUT THE TURN SERVER IS BUILDING WITHOUT MYSQL DATABASE SUPPORT.HIREDIS DEVELOPMENT LIBRARY (libhiredis.*) AND/OR HEADERS (hiredis/*.h)ARE NOT INSTALLED PROPERLY ON THIS SYSTEM.THAT'S OK BUT THE TURN SERVER IS BUILDING WITHOUT REDIS SUPPORT.PREFIX=/usr/local OSLIBS= -L/usr/local/lib/ -L/usr/local/lib/ -L/usr/local/lib64/ -L/usr/local/lib64/ -lrt -pthread -lcrypto -lssl -levent_core -levent_openssl -levent_pthreads  -Wl,-rpath,/usr/local/lib/ -Wl,-rpath,/usr/local/lib/ -Wl,-rpath,/usr/local/lib64/ -Wl,-rpath,/usr/local/lib64/ -Wl,-rpath,/usr/lib64/mysql -Wl,-rpath,/usr/local/lib DBLIBS= OSCFLAGS=-g  -Wall -Wno-deprecated-declarations -Wextra -Wformat-security -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Wcast-qual -I/usr/local/include -I/usr/local/include/ -I/usr/local/include  -DTURN_HAS_DAEMON    -DINSTALL_PREFIX=/usr/local DBCFLAGS=

只是说没有数据库支持的库,暂时不需要。

安装之后说明:

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 Redisdatabase schema description and/or /usr/local/share/turnserver/schema.stats.redisas 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

在根目录创建一个user.db文件
使用turnserver启动:

turnserver --userdb /root/turnuser.db
里面是webrtc用户名密码:
webrtc:secret

3,页面调用

https://github.com/EricssonResearch/openwebrtc-examples/tree/master/web
安装node参考之前文章:
http://blog.csdn.net/freewebsys/article/details/46649667#t1

修改main.js

// must use 'url' here since Firefox doesn't understand 'urls'
var configuration = {"iceServers": [{"url": "stun:mmt-stun.verkstad.net"},{"url": "turn:mmt-turn.verkstad.net","username": "webrtc","credential": "secret"}]
};

将stun服务器和turn服务器替换。

4,总结

本文的原文连接是: http://blog.csdn.net/freewebsys/article/details/47109183 未经博主允许不得转载。

stun和trun是webrtc打通的关键服务器,但是资源有限没有在公网测试。

webrtc(2):Centos6 安装 stun/turn服务相关推荐

  1. 安装 stun/turn服务

    1,关于stun和turn STUN(Simple Traversal of UDP over NATs,NAT 的UDP简单穿越)是一种网络协议,它允许位于NAT(或多重NAT)后的客户端找出自己的 ...

  2. WebRTC 入门教程(二)| WebRTC信令控制与STUN/TURN服务器搭建

    本文将向大家介绍两个方面的知识: WebRTC信令控制 STUN/TURN服务器的搭建 在https://mp.csdn.net/postedit/92436226已经向大家介绍了如何构建信令服务器. ...

  3. Centos7 安装coturn部署一套 STUN/TURN 服务 webRTC打洞服务器

    1.安装相关依赖 yum install -y make gcc cc gcc-c++ wget openssl-devel libevent libevent-devel 2.下载可以编译的源码包 ...

  4. 构建WebRTC应用程序所需的后端服务——STUN, TURN, and signaling

    开篇导读,这篇是从 https://www.html5rocks.com/en/tutorials/webrtc/infrastructure/ 搬运翻译过来的,属于WebRTC理论入门,感觉属于把w ...

  5. 构建 WebRTC 应用所需的后端服务 STUN, TURN

    Build the backend services needed for a WebRTC app STUN, TURN, and signaling 机翻 原文:Build the backend ...

  6. WebRTC中的信令和内网穿透技术 STUN / TURN

    Translated from WebRTC in the real world: STUN, TURN and signaling. 最近刚接触到WebRTC,网上看到这篇介绍WebRTC的文章不错 ...

  7. (译)WebRTC实战: STUN, TURN, Signaling

    http://xiaol.me/2014/08/24/webrtc-stun-turn-signaling/ 原文:WebRTC in the real world: STUN, TURN and s ...

  8. WebRTC in the real world: STUN, TURN and signaling

    http://www.cnblogs.com/bktmkd/p/5100082.html 翻译☞http://www.html5rocks.com/en/tutorials/webrtc/infras ...

  9. 真实场景中WebRTC 用到的服务 STUN, TURN 和 signaling

    翻墙收录转自:WebRTC in the real world: STUN, TURN and signaling WebRTC enables peer to peer communication. ...

最新文章

  1. java子程序_JAVA-JVM的执行子程序(类加载)
  2. 一起撸个朋友圈吧 图片浏览(上)【图片点击前景色】
  3. leetcode 986. Interval List Intersections | 986. 区间列表的交集(双指针)
  4. C++ Handle(句柄) part1
  5. 墨子科技成果是计算机,祖国强起来!为2017年这些重大科技成果打call
  6. 人工神经网络算法原理和应用
  7. php 开发商城 注意,开发PHP商城要注意的一些常见安全问题
  8. struts2.3+spring3.2+hibernate4.2例子
  9. FreeRTOS之源码 及 移植详解
  10. linux常用命令详解(二)
  11. interpreter_command_state pattern
  12. 21天学通Java 下载参考
  13. leetcode 面试题57 - II. 和为s的连续正数序列
  14. 监听支付宝、微信 二合一 个人免签最新,运行起来之后无需人工操作,绕过验证码
  15. 为什么我们的代码难以维护(草稿)
  16. 什么是类、什么是对象
  17. 实现抖音霓虹灯效果---OpenCV-Python开发指南(55)
  18. pat乙级 1006 题解
  19. sublime text 使用简单说明
  20. 关于TQ2440通过Jlink下载Uboot到开发板的方法(不能识别自己板子的norflash型号,且不能安装USB)

热门文章

  1. Centos6安装SGE以及集群配置
  2. hadoop集群搭建及易踩坑收录
  3. 《夏洛的网》思维导图读书笔记
  4. Laya页面嵌套和Scene.destory导致的Bug
  5. html页面打印+区域,实现web网页指定区域打印的三种方法
  6. 问题解决:VScode在使用中文输入法时出现vim insert模式变成vim normal的奇怪现象( jj 映射成esc)
  7. 2018年高德地图POI全国数据下载
  8. 如何设置计算机自动连接宽带,宽带自动连接设置,教您电脑怎么设置宽带自动连接...
  9. 指纹识别 python实现_Python语言之指纹识别是目前最成熟的识别技术!Python能分分钟做出一个来!...
  10. 将机械硬盘换成固态硬盘的装机过程