转载请注明出处:https://blog.csdn.net/impingo
项目地址:https://github.com/im-pingo/pingos
目录
这里不对OWT-Server做过多介绍,这篇文章主要讲解如何编译和安装OWT-Server。
服务器环境:
- Ubuntu 18.04 (据说 Ubuntu 16.04也可以,没试过)
- CentOS 7.6
下载源码
wget https://github.com/open-webrtc-toolkit/owt-server/archive/v4.3.zip -O owt-server-4.3.zip
unzip owt-server-4.3.zip
安装依赖
注意安装依赖环境的脚本有两个,运行任意一个都可以,但是为了安装简便性,建议运行非交互式安装脚本。
- 交互式安装,scripts/installDeps.sh,在安装每个依赖包前需要操作者手动确认yes/no,比较繁琐
- 非交互式安装,./scripts/installDepsUnattended.sh,自动安装所有依赖的软件包,不需要手动确认,方便快捷,推荐使用。
cd owt-server-4.3
./scripts/installDepsUnattended.sh
编译过程
编译OWT-Server
scripts/build.js -t mcu --check
OWT-Server在GitHub README 上描述的是 -t all,但是对于不支持硬件加速的云主机或者虚拟机来说这样 build 会失败,所以如果不支持硬件加速或者不需要硬件加速的话,请使用-t mcu
编译 owt-client-javascript
wget https://github.com/open-webrtc-toolkit/owt-client-javascript/archive/v4.3.zip -O owt-client-javascript-4.3.zip
unzip owt-client-javascript-4.3.zip
cd owt-client-javascript-4.3/scripts/
npm install
grunt
执行过程中可能会遇得到下面这个报错
[root@10-8-177-188 scripts]# npm install
> iltorb@1.3.10 install /root/owt-client-javascript/node_modules/iltorb
> detect-libc prebuild-install || node-gyp rebuild
prebuild-install WARN install EACCES: permission denied, access '/root/.npm'
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/root/owt-client-javascript/node_modules/iltorb/build'
gyp ERR! System Linux 3.10.0-1062.9.1.el7.x86_64
gyp ERR! command "/root/node-v8.15.1-linux-x64/bin/node" "/root/node-v8.15.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/owt-client-javascript/node_modules/iltorb
gyp ERR! node -v v8.15.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN lifecycle owt-client-javascript@4.3.0~postinstall: cannot run in wd owt-client-javascript@4.3.0 cd scripts && grunt prepare (wd=/root/owt-client-javascript)
npm WARN owt-client-javascript@4.3.0 No repository field.
npm WARN owt-client-javascript@4.3.0 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: iltorb@1.3.10 (node_modules/iltorb):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: iltorb@1.3.10 install: `detect-libc prebuild-install || node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
如图:

解决办法:
npm i --unsafe-perm
然后重新执行npm install和grunt
打包 owt-server
cd ~/owt-server-4.3/
./scripts/pack.js -f -s ~/owt-client-javascript-4.3/dist/samples/conference/
说明:
pack 成功后,会生成dist目录,dist目录里就是我们运行需要的所有文件。如果你修改了源码,需要重新执行pack。
配置 owt-server
如果你的机器有多块网卡,或者对外提供服务的IP不是你本地网卡的IP,而是公网IP,你需要做如下配置。
- 打开webrtc_agent/agent.toml目录,设置你服务器的公网IP,修改 [webrtc] 部分的 network_interfaces
{name = "eth0", replaced_ip_address = "你的公网IP"}(需要把 name 设置为网卡实际名称,replaced_ip_address 设置为服务器公网 IP 地址)
如图:

2. 编辑 portal/portal.toml:修改 [portal] 部分里的 ip_address 为服务器公网 IP 地址
如图

运行 owt-server
cd ~/owt-server-4.3/dist
./bin/init-all.sh --deps
./bin/start-all.sh
验证结果
如果以上流程都顺利,接下来你就可以访问服务器的demo体验mcu功能了。
测试mcu功能
访问页面:https://ip:3004

测试sfu功能
访问页面:https://ip:3004/forward=true

QQ交流群:697773082
QQ交流群:697773082

7874

被折叠的 条评论
为什么被折叠?



