forked from ant-media/Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_turn-server.sh
32 lines (27 loc) · 926 Bytes
/
install_turn-server.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
#
# Turn Server Installation Script
#
IP=`curl http://checkip.amazonaws.com`
USERNAME=$(openssl rand -hex 6)
PASSWORD=$(openssl rand -hex 12)
check() {
OUT=$?
if [ $OUT -ne 0 ]; then
echo "There is a problem in installing the turn server. Please send the log of this console to [email protected]"
exit $OUT
fi
}
sudo apt-get update && apt-get install coturn -y
check
echo "TURNSERVER_ENABLED=1" > /etc/default/coturn
echo "realm=$IP" >> /etc/turnserver.conf
echo "user=$USERNAME:$PASSWORD" >> /etc/turnserver.conf
sudo systemctl enable coturn && sudo systemctl restart coturn
check
echo ""
echo "Username: $USERNAME"
echo "Password: $PASSWORD"
echo "Turn Server Address: $IP"
echo "Please check this guide to enable the Turn Server: https://antmedia.io/docs/guides/advanced-usage/turn-and-stun-installation/coTURN-quick-installation/#how-to-add-turn-server-to-ant-media-sample-pages"
echo ""