Reference http://www.cnblogs.com/wunaozai/p/5520084.html
Step 0 Preparation
- make sure you are the root user
-
apt-get update
andapt-get upgrade
- make sure git is installed in your Ubuntu. If not, run
apt-get install git
- make a directory such as
mkdir /sky
wherever you like.
Step 1 Install Signaling Server
cd /sky
apt-get install nodejs npm
git clone https://github.com/LingyuCoder/SkyRTC-demo
cd SkyRTC-demo
npm install
Step 2 Install Coturn Server
cd /sky
git clone https://github.com/coturn/coturn
cd coturn
./configure
make
make install
Step 3 Modify Client Configuration
cd /sky/SkyRTC-demo/public
nano SkyRTC-client.js
- modify iceServers configuration like
var iceServer = {
"iceServers": [
{
url: "stun:(you server name, such as 120.120.120.120)"
},
{
url: "turn:(you server name, such as 120.120.120.120)",
credential:'(set a psw you like)',
username:'(set your username)'
}
]
};
-
cd /sky/coturn/examples/etc
andcp turnserver.conf turnserver.conf.bak
for file backup, then runnano turnserver.conf
, change all the content to
listening-device=eth1
listening-ip=(you server name, such as 120.120.120.120)
min-port=59000
max-port=65000
relay-device=eth1
relay-ip=(you server name, such as 120.120.120.120)
Verbose
fingerprint
lt-cred-mech
use-auth-secret
static-auth-secret=4080218913
stale-nonce
realm=(you server name, such as 120.120.120.120)
cert=/sky/coturn/examples/etc/turn_server_cert.pem (you may change this directory)
pkey=/sky/coturn/examples/etc/turn_server_pkey.pem (you may change this directory)
no-loopback-peers
no-multicast-peers
mobility
no-cli
Step 4 Start Service
-
cd /sky/coturn/examples/etc
and run the followings to start coturn server (replace username and credential by what you set in step 3)
turnserver -o -a -f -v --mobility -m 10 --max-bps=100000 --min-port=32355 --max-port=65535 --user=(username):(credential) -r demo
-
cd /sky/SkyRTC-demo
and runnodejs server.js
to start signaling server and room server
Step 5 Enjoy WebRTC
- open your browser and enter
http://(you server name, such as 120.120.120.120):3000#(rommId)
for example
http://120.120.120.120:3000#myroom
and open another browser tab enter the same URL.
note: Firefox and 360 explorer (Chrome mode) are recommended.
- you will see some output messages in your terminal, and you can try some other functions like file sharing provided by SkyRTC.