webrtc turn服务器搭建

测试环境ubuntu 22LTS

首先从github上下载源码编译 GitHub - coturn/coturn: coturn TURN server project

用的tag docker/4.6.2-r7

./configure --prefix =/usr/local/coturn

复制代码
make

安装coturn的时候还需要安装一些依赖包

apt-get install pkg-config

apt-get install openssl

然后修改coturn 下etc下的配置文件

主要内容

cpp 复制代码
listening-device=eth0
listening-ip=xxxx //云服务器内网ip
listening-port=3478
tls-listening-port=5349
relay-device=eth0
relay-ip=x.x.x.x //云服务器内网ip
min-port=49152
max-port=65535
external-ip=x.x.x.x //云服务器外网ip
fingerprint
lt-cred-mech
realm=voicevison.com
#userdb=/var/lib/turn/turndb
user=denghg:123456 #用户名密码
stale-nonce
no-loopback-peers
no-multicast-peers
mobility
no-cli
cert=/etc/turn_server_cert.pem  证书注意放在/usr/local/etc目录下不然可能找不到
pkey=/etc/turn_server_pkey.pem

然后说一下生成证书的参数

sudo openssl req -x509 -newkey rsa:2048 -keyout turn_server_pkey.pem -out turn_server_cert.pem -days 99999 -nodes

这里会生成证书的公钥私钥

非常重要的一点启动turn服务器的时候要带上域名 还没验证过没有域名能不能用

turnserver -o -a -f -r 【voicevison.com】 -c /etc/turnserver.conf

关闭turn服务命令

killall turnserver

记得去阿里云开3478和5349的udp tcp端口

测试网址

Trickle ICE

测试内容

相关推荐
三84440 分钟前
使用Samba/NFS实现文件共享/自动挂载共享目录/autofs自动挂载服务
linux·服务器·网络
高铭杰1 小时前
万物皆可KV(2)SurrealDB 存储布局分析
linux·服务器
万事可爱^1 小时前
Claude 新发布的 Opus 5,系统提示语删了 80%,半价还能逼近 Fable 5
android·服务器·数据库·人工智能·claude
Jerry小杰2 小时前
运维神器|单端口搞定多台内网SSH!frp端口复用终极教程
运维·ssh
Python私教2 小时前
Blender模型导入Godot完整教程:GLB、BLEND与继承场景怎么选
运维·godot·blender
其实防守也摸鱼3 小时前
GitHub开源项目破圈方法论:从技术自嗨到生态共赢
服务器·数据库·学习·开源·github·命令行·linux系统
爱写代码的森3 小时前
鸿蒙三方库 | harmony-utils之PasteboardUtil剪贴板数据读写详解
服务器·华为·harmonyos·鸿蒙·huawei
AOwhisky3 小时前
Linux(CentOS)系统管理入门笔记(第十二期)——系统管理工具与软件包管理(上篇):Cockpit 与 RPM 包管理
linux·运维·笔记·centos·云计算
xlq223224 小时前
高并发服务器day5
java·服务器·数据库
明日清晨4 小时前
printf(“%p\n“,&((struct A *)NULL)->m_float)的原理
linux·服务器·前端