简体   繁体   English

如何使用AWS EC2创建stun turn服务器实例

[英]How to create stun turn server instance using AWS EC2

实际上我想使用我自己的stun / Turn服务器实例,我想使用Amazon EC2。如果有人对此有任何想法,请与我分享创建步骤或任何参考链接。

do an ssh login to your ec2 instance, then run the below commands for installing and starting the turn server. 对你的ec2实例进行ssh登录,然后运行以下命令来安装和启动转弯服务器。

simple way: 简单方法:

sudo apt-get install coturn

If you say no, I want the latest cutting edge, you can download source code from their downloads page in install it yourself, example: 如果您拒绝,我想要最新的前沿,您可以从他们的下载页面下载源代码,自行安装,例如:

sudo -i     # ignore if you already in admin mode
apt-get update && apt-get install libssl-dev libevent-dev libhiredis-dev make -y    # install the dependencies
wget -O turn.tar.gz http://turnserver.open-sys.org/downloads/v4.5.0.3/turnserver-4.5.0.3.tar.gz     # Download the source tar
tar -zxvf turn.tar.gz     # unzip
cd turnserver-*
./configure
make && make install 

sample command for running TURN server: 用于运行TURN服务器的示例命令:

turnserver -a -o -v -n -u user:root -p 3478 -L INT_IP -r someRealm -X EXT_IP/INT_IP  --no-dtls --no-tls

command description: 命令说明:

  • -X - your amazon instance's external IP, internal IP: EXT_IP/INT_IP -X - 您的亚马逊实例的外部IP,内部IP:EXT_IP / INT_IP
  • -p - port to be used, default 3478 -p - 要使用的端口,默认3478
  • -a - Use long-term credentials mechanism -a - 使用长期凭证机制
  • -o - Run server process as daemon -o - 将服务器进程作为守护程序运行
  • -v - 'Moderate' verbose mode. -v - '中等'详细模式。
  • -n - no configuration file -n - 没有配置文件
  • --no-dtls - Do not start DTLS listeners --no-dtls - 不要启动DTLS监听器
  • --no-tls - Do not start TLS listeners --no-tls - 不要启动TLS监听器
  • -u - user credentials to be used -u - 要使用的用户凭据
  • -r - default realm to be used, need for TURN REST API -r - 要使用的默认域,需要TURN REST API

in your WebRTC app, you can use trun server like: 在您的WebRTC应用程序中,您可以使用如下的trun服务器:

{
    url: 'turn:user@EXT_IP:3478',
    credential: 'root'
}

One method to install a turnserver on Amazon EC2 would be to choose Debian and to install the coturn package, which is the successor of the RFC5766-server. 在Amazon EC2上安装转向服务器的一种方法是选择Debian并安装coturn软件包,这是RFC5766服务器的后续版本。

The configuration file at /etc/turnserver.conf includes EC2 specific instructions. /etc/turnserver.conf中的配置文件包含EC2特定指令。 The information provided within this file is very exhaustive in general and should answer the majority of configuration questions. 此文件中提供的信息通常非常详尽,应该回答大多数配置问题。

Once configured, the coturn server can be stopped an started however you would any other service. 配置完成后,可以停止启动coturn服务器,但是您可以使用任何其他服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM