coturn服务器搭建

news/2024/7/8 4:15:54

coturn服务器搭建

    • libevent下载安装
    • coturn下载安装
    • 查看是否安装成功
    • 修改配置信息
    • 启动服务
    • 遇见的问题
  • 补充

libevent下载安装

依赖libevent开源库,需要先进行安装:

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

coturn下载安装

git clone https://github.com/coturn/coturn
cd coturn 
./configure 
make 
make install

查看是否安装成功

which turnserver

修改配置信息

vi /usr/local/etc/turnserver.conf

修改配置文件信息:

relay-device=eth0   #与前ifconfig查到的网卡名称一致
listening-ip=106.75.26.76   #内网IP
listening-port=3478	#默认端口号
tls-listening-port=5349
relay-ip=10.10.128.111
external-ip=10.10.128.111   #公网IP
relay-threads=50
lt-cred-mech
cert=/etc/turn_server_cert.pem
pkey=/etc/turn_server_pkey.pem
pidfile=”/var/run/turnserver.pid”
min-port=49152	     #最小端口号
max-port=65535	     #最大端口号
user=ceshi:123456    #用户名密码,创建IceServer时用

用户名密码使用如下:

List<String> urls = new ArrayList<>();
urls.add("turn:106.75.26.76:3478?transport=udp");
urls.add("turn:106.75.26.76:3478?transport=tcp");
this.iceServers.add(PeerConnection.IceServer.builder(urls).setUsername("ceshi").setPassword("123456").setTlsCertPolicy(TLS_CERT_POLICY_SECURE).createIceServer());

启动服务

turnserver -o -a -f -user=ceshi:123456 -r Beijing

遇见的问题

问题1:

[root@10-10-128-155 coturn]# ./configure
install is /usr/bin/install
pkill is /usr/bin/pkill
sqlite3 is /usr/bin/sqlite3
Use TMP dir /var/tmp
Compiler: cc
Library option -lsocket cannot be used
Library option -lwldap32 cannot be used
Library option -lwldap64 cannot be used
Library option -lintl cannot be used
Sockets code is fine: no sin_len field present
Ignore IP_RECVERR
Library option -lcrypto cannot be used
ERROR: OpenSSL Crypto development libraries are not installed properly in required location.
Abort.

解决方案:
需要依赖openssl库

yum install openssl-devel

问题2:

CONFIG ERROR: Empty cli-password, and so telnet cli interface is disabled! Please set a non empty cli-password!

解决方案:
在配置文件/usr/local/etc/turnserver.conf中,添加cli-password字段,修改后的配置文件如下:

relay-device=eth0   #与前ifconfig查到的网卡名称一致
listening-ip=106.75.26.76   #内网IP
listening-port=3478	#默认端口号
tls-listening-port=5349
relay-ip=10.10.128.111
external-ip=10.10.128.111   #公网IP
relay-threads=50
lt-cred-mech
cert=/etc/turn_server_cert.pem
pkey=/etc/turn_server_pkey.pem
pidfile=”/var/run/turnserver.pid”
min-port=49152	     #最小端口号
max-port=65535	     #最大端口号
user=ceshi:123456    #用户名密码,创建IceServer时用
cli-password=123456

补充

如果以上步骤后发现穿透服务器无法工作,可以在执行时尝试添加- v参数,打印更详细的日志,https://blog.csdn.net/Martin_chen2/article/details/102970731也记录了我部署coturn的问题,可供参考。

参考链接:
https://github.com/pchab/ProjectRTC
https://github.com/pchab/AndroidRTC
https://www.jianshu.com/p/915eab39476d


http://www.niftyadmin.cn/n/3656199.html

相关文章

HtmlTextWriter学习笔记

这两天正好在研究asp.net自定义控件制作&#xff0c;HtmlTextWriter在控件制作中发挥重要作用&#xff0c;能够帮助我快速生成html语句。因此决定写下笔记&#xff0c;方便以后查阅。HtmlTextWriter的名称空间是System.Web.UI&#xff0c;如果在winform程序下使用&#xff0c;不…

开源webrtc源码分析

想写一篇分析webrtc源码的文章&#xff0c;梳理了半天&#xff0c;发现webrtc太大了&#xff0c;不知道从哪里开始。那就先从android源码开始吧&#xff0c;纯手打&#xff0c;如有不对之处&#xff0c;请及时指正。 java层代码分析 api目录&#xff1a;提供android端可以直接…

php中session常用函数

session_start() 该函数表明本页需要使用session&#xff0c;如果不使用该函数&#xff0c;将有可能导致其他函数和session变量无法正常使用&#xff0c;类似于初始化函数。 session_register() 该函数用于注册普通变量为Session变量&#xff0c;如 $a1; session_register(&quo…

U盘无法识别

之前用U盘启动装centos 系统 &#xff0c;把一个centos7.2的系统刻录到了一个8G的U盘&#xff0c;之后是centos安装成功了 &#xff0c;却发现在windows下不认识U盘了。 解决方法如下&#xff08;在linux下操作&#xff09;&#xff1a; 查看U盘加载文件 fdisk -l先卸载掉 um…

kurento服务器搭建

Kurento media server服务搭建一、下载ubuntu18.04服务器1、安装gunpg2、确定ubuntu版本3、设置变量4、添加key5、设置kurento.list6、安装kurento media server7、启动/停止/状态/重启二、kurento tutorial java服务搭建三、kurento相关配置1、Kurento Media Server 日志2、Ku…

《精通.Net核心技术》

共两册 《精通.Net核心技术——原理与架构》 价格不明 《精通.Net核心技术——高级特性》 价格&#xff1a;79&#xff08;附光盘&#xff09; 飞思科技产品研发中心编著 电子工业出版社

check_stun_auth: user cece credentials are incorrect

记录部署coturn服务器的一个问题&#xff0c;coturn的部署记录可参考https://blog.csdn.net/Martin_chen2/article/details/101641584&#xff1a; coturn服务器部署后&#xff0c;执行turnserver -a -f -usercece:123456 -r Guangdong后&#xff0c;运行移动端demo&#xff0…