turn搭建测试

安装

安装环境

cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

相关系统环境安装

sudo yum install -y make gcc cc gcc-c++ wget

sudo yum install -y openssl-devel libevent libevent-devel

安装libEvent组件

# 如果链接不可用直接去官网找对应release包下载
wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz

tar -xvfz libevent-2.0.21-stable.tar.gz

cd libevent-2.0.21-stable 

./configure

make

sudo make install

cd ..

安装turn服务

wget http://turnserver.open-sys.org/downloads/v4.5.1.2/turnserver-4.5.1.2.tar.gz

tar -xvzf turnserver-4.5.1.2.tar.gz

cd turnserver-4.5.1.2 && ./configure

make 

sudo make install

配置测试

生成证书

openssl req -x509 -newkey rsa:2048 -keyout /usr/local/etc/turn_server_pkey.pem -out /usr/local/etc/turn_server_cert.pem -days 99999 -nodes

修改配置

cp /usr/local/etc/turnserver.conf.default /local/etc/turnserver.conf

# 直接shift+G跳到文本尾部
listening-ip=内网IP
listening-port=3478
tls-listening-port=5349
relay-ip=内网IP
external-ip=对外公网IP
relay-threads=50
lt-cred-mech
min-port=49152
max-port=65535
cert=/usr/local/etc/turn_server_cert.pem
pkey=/usr/local/etc/turn_server_pkey.pem
pidfile=/var/run/turnserver.pid
user=admin:123456
no-cli

启动服务

turnserver -v -r ${公网IP}:3478 -a -o -c /usr/local/etc/turnserver.conf

测试

  • 测试地址
  • 结果
    turn搭建测试_第1张图片

你可能感兴趣的:(音视频,webrtc,turn)