Ubuntu Server 14.04下配置coturn for WebRTC

    xiaoxiao2021-03-25  93

    coturn功能比较全,配合WebRTC和Chrome使用蛮好,我在Ubuntu Server 14.04下配置了一下,过程记录在这里。

    coturn的资料

    github主页:https://github.com/coturn/coturn。

    coturn配置文档:https://github.com/coturn/coturn/wiki/CoturnConfig。

    turnserver命令的使用:https://github.com/coturn/coturn/wiki/turnserver。

    Ubuntu下的安装

    可能默认的apt源里没有coturn对应的deb包,参考这个链接https://packages.debian.org/sid/amd64/coturn/download来修改sources.list,然后执行sudo apt-get update更新一下,接下来执行下面的命令就可以安装了:

    sudo apt-get install coturn

    现在的版本是4.5.0.5,实现了RFC 3489 、5389、5766、5780、6062、6156,可以作为STUN或TURN服务器使用。

    添加认证用户

    coturn有一个工具,turnadmin,可以添加用户,使用类似下面的命令:

    sudo turnadmin -a -u username -r realm -p password

    具体可能是这样的:

    sudo turnadmin -a -u foruok -r foruok.com -p 12345678

    turnadmin默认使用SQLite3,对应的数据库文件为/var/lib/turn/turndb(Ubuntu Server上的位置,其它系统可能不一致)。

    启动turnserver

    类似这样的命令:

    sudo turnserver -n -a --listening-ip=192.168.40.124 --listening-port=3478 -r foruok.com

    -n 指定不要配置文件

    -a 指定支持WebRTC的 long-term credentials mechanism

    -r 指定realm

    更多参数,参见:https://github.com/coturn/coturn/wiki/turnserver。


    相关阅读:

    WebRTC源码中turnserver的使用方法Ubuntu 14.04下编译WebRTCWebRTC学习资料大全
    转载请注明原文地址: https://ju.6miu.com/read-12534.html

    最新回复(0)