虚拟机配置
建议安装64位Ubuntu-14.04.1-desttop LTS版,apprtc官方安装说明上也提及了该版本,异常问题较少,整个过程需要翻墙,设置好代理
设置系统代理
以下代理IP需自行替换
/etc/profile末尾添加
http_proxy= http://10.159.32.155:8080
https_proxy= http://10.159.32.155:8080
ftp_proxy= ftp://10.159.32.155:8080
export http_proxy https_proxy ftp_proxy
保存退出后执行 $ source /etc/profile
更新生效
设置apt-get代理
/etc/apt/apt.conf(没有就自己创建)末尾添加
Acquire:: http::Proxy "http://10.159.32.155:8080";
Acquire:: https::Proxy "https://10.159.32.155:8080 ";
Acquire:: ftp::Proxy "ftp://10.159.32.155:8080 ";
保存退出后更新源 $ apt-get -o Debug:: Acquire::http=true update
设置 git 代理(临时)
$ git config --global http.proxy http://10.159.32.155:8080
$ git config --global https.proxy http://10.159.32.155:8080
设置npm代理(临时)
$ npm config set proxy http://10.159.32.155:8080
$ npm config set https-proxy http://10.159.32.155:8080
安装apprtc
下载源码
$ git clone https://github.com/webrtc/apprtc.git
不要下载到共享文件夹中,否则可能出现各种异常问题
安装方法
参考README.md
安装grunt之前先安装nodejs,npm是nodejs的管理工具
$ sudo apt-get install nodejs
$ sudo npm install -g npm
如需升级node,使用nvm,具体参考帖子
在Ubuntu14.04版本上默认安装是/usr/bin/nodejs,但是grunt需要的是/usr/bin/node,可以安装nodejs-legacy这个包解决。
$ sudo apt-get intsll nodejs-legacy
使用npm安装grunt-cli是最简单的方式,-g为全局安装
$ sudo npm install grunt-cli -g
最后进入apprtc目录,安装所有依赖包
$ sudo npm install
在这个阶段,可能会遇到一个问题
Downloading http://dl.google.com/closure-compiler/compiler-latest.tar.gz … Download failed: Error: connect ETIMEDOUT
Unfortunately, ClosureCompiler.js could not be configured. See: https://github.com/dcodeIO/ClosureCompiler.js (create an issue maybe)
在这个帖子中找到一个不算很好的方案,但确实解决了问题。原因在于执行的脚本下载包时没有使用代理,方法是注释掉脚本中下载失败后退出语句,手动下载包并解压到指定路径,具体查看笔记《closure-compiler install error》
在Ubuntu上,还需要安装webtest
$ sudo apt-get install python-webtest
在启动AppRTC或每次修改代码后