SU switch user
1.-2.0 to download and install the libevent
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
the tar-2.0.21-stable.tar.gz zxvf the libevent
libevent 2.0.21-stable-cd && ./configure
the make the make install &&
2. Download compile and install coturn
git clone https://github.com/coturn/coturn
cd coturn
./configure
the make
the make install
3. Check whether the installation was successful
which turnserver
4. first check card, and records the name of the network card addresses
the ifconfig
5. the signed certificate using openssl command to install
self-signed certificate and 6. cert pkey configuration command generating Openssl:
openssl -newkey REQ -x509 the RSA: 2048 -keyout / etc / turn_server_pkey.pem -out /etc/turn_server_cert.pem -days 99999 -nodes
7. The configuration file has turnserver.conf.default in / usr / local / etc / directory, copying of turnserver.conf
CD / usr / local / etc /
CP turnserver.conf.default turnserver.conf
8. The modified configuration information (Listening -ip the network using relay-ip ip, external-ip ip is outside the network)
VI /usr/local/etc/turnserver.conf
#与前ifconfig查到的网卡名称一致
relay-device=eth0
listening-ip=172.19.176.106
relay-ip=172.19.176.106 #relay-ip 可以不设置,默认会使用你的外网ip地址作为转发包的中继地址
listening-port=3478 #监听端口可以不设置会默认的使用3478
tls-listening-port=5349
external-ip=156.000.111.222 #注意必须使用你的外网IP地址
relay-threads=50
lt-cred-mech
cert=/etc/turn_server_cert.pem
pkey=/etc/turn_server_pkey.pem
pidfile="/var/run/turnserver.pid"
user=zq:123456 #用户名密码,创建IceServer时用
cli-password=qwerty
userdb=/var/db/turndb #SQLite
-
Create a user
turnadmin -a -b turndb -u zq -p 123456 -r zqturn -
Start Service
turnserver -o -a -f -user = zq: 123456 -r zqturn -
View the process
ps -ef | grep turnserver -
Firewall settings
added
Firewall-cmd = --zone public --add-Port = 3478 / UDP --permanent
Firewall-cmd = --zone public --add-Port = 3478 / TCP --permanent
reload
firewall-cmd - -reload
restart firewall
systemctl restart firewalld
Note: be sure to add a port rule used in the security group your cloud server in the background, including the tcp / udp 3478 port, udp must configure -
Test
https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/