天天看點

ubuntu16.04下安裝配置coturn一、安裝軟體包二、配置coturn三、完成安裝

一、安裝軟體包

apt update
apt install coturn
           

二、配置coturn

1、複制DTLS、TLS支援的證書檔案:

cp /usr/share/coturn/examples/etc/turn_server_cert.pem /etc/turn_server_cert.pem
cp /usr/share/coturn/examples/etc/turn_server_pkey.pem /etc/turn_server_pkey.pem
           

2、編輯/etc/turnserver.conf檔案:

listening-port=3478
tls-listening-port=5349
listening-ip=内網位址
relay-ip=内網位址
external-ip=外網位址
server-name=外網位址
realm=外網位址
lt-cred-mech
user=使用者名:密碼
userdb=/var/lib/turn/turndb
cert=/etc/turn_server_cert.pem
pkey=/etc/turn_server_pkey.pem
no-stdout-log
log-file=/var/tmp/turnserver.log
pidfile="/var/run/turnserver.pid"
           

3、編輯/etc/default/coturn檔案:

TURNSERVER_ENABLED=1
           

三、完成安裝

1、重新開機coturn

service coturn restart
           

2、端口開放

ubuntu16.04下安裝配置coturn一、安裝軟體包二、配置coturn三、完成安裝

3、測試驗證

turnadmin -a -u test -r 外網位址(域名) -p test
 turnutils_uclient 外網位址(域名) -u test -w test
           

測試結果

ubuntu16.04下安裝配置coturn一、安裝軟體包二、配置coturn三、完成安裝

然後就可以去使用了,如下:

var configuration = {
              'iceServers': [{
                 'urls': 'turn:外網位址:3478',
                 'credential': "密碼",
                 'username': "使用者名"
              }]
};
           

繼續閱讀