0. 前言
licode官網文檔安裝教程十分簡單, 但是實際搭建過程是很艱辛的. 官方文檔沒有提示說會遇到什么樣的問題, 實際過程中可能遇到各種各樣的問題, 在解決的時候費時費力, 我就總結一下自己在安裝搭建過程中遇到的問題.
注: 最大的問題就是網絡問題, 整個安裝過程是邊下載資源邊安裝的, 資源基本都是國外的, 因為牆的緣故, 可能會遇到想不到的錯誤.
1. 環境
系統: ubuntu16.04.6 ( ubuntu14.04.6也可以 )
用戶: root
執行時最好加 sudo
官方安裝教程地址: https://licode.readthedocs.io/en/master/from_source/
2. 搭建
下面是我引用licode官方教程中一些主要步驟內容
Clone Licode
Let's start by cloning the Licode repository
git clone https://github.com/lynckia/licode.git
cd licodeThe repository contains scripts for the rest of the steps of this guide.
Install dependencies
This step installs the dependencies of all the Licode components. This is the only step that depends on your OS
./scripts/installUbuntuDeps.sh
Install Licode
Here we will install all the Licode components in your computer.
./scripts/installNuve.sh
./scripts/installErizo.shInstall basicExample
The basicExample is a really simple node-based web application that relies on Licode to provide a videoconferencing room.
./scripts/installBasicExample.shStart Licode!
At this points, you have successfully installed all the Licode components in your computer and also a simple application that will let you try it. Let's use the convenience script to start all Licode components:
./scripts/initLicode.shAfter that, we just have to start our node application, we also have a script for that:
./scripts/initBasicExample.shNow you can connect to http://localhost:3001 with Chrome or Firefox and test your basic videoconference example!
What's next?
Well you now have a taste of what Licode can do. You can start by modifying basicExample. You can find the code in licode/extras/basic_example: * basicServer.js is the node.js server that manages the communication between the clients and Nuve. Here you can add your own methods using the server side API (NuveAPI)
Head to Licode Architecture for more information about different Licode components, or start developing your custom service getting into the client or server APIs.
注: 如果可以翻牆, 而且網速還可以, 將會減少很多下載安裝的問題
網絡問題可能會報一些連接超時問題或找不到包, 建議重試或者更換網絡.
licode中nvm需要安裝的node版本是6.14.4, 但我這邊使用nvm ls-remote 命令看到遠程庫中只有1.x.x~3.x.x版本.
(其實遠程庫應該是有nodejs版本的, iojs和nodejs在兩個不同地址的版本庫, 很可能因為牆的原因, 導致版本庫加載不出來)
1.x.x~3.x.x 是iojs版本
0.x.x 以及4.x.x~10+.x.x是nodejs版本
開始嘗試更改licod路徑下的.nvmrc配置, 把6.14.4版本號換成3.1.0版本號.
於是nvm安裝的為iojs3.1.0, 前面都很成功.
但是到后面編譯時發現
安裝低版本的node發現執行 ./scripts/installNuve.sh 會報錯
之后又更改安裝腳本代碼, 更換了國內源, 可以加載iojs版本和nodejs版本, 成功安裝了6.14.4版本nodejs
在nvm.sh(路徑: ./licode/build/libdeps/nvm/)中修改源地址為國內源 如: https://npm.taobao.org/dist

或者在installUbuntuDeps.sh中對應位置添加如下框起來的代碼(臨時環境變量, 把國內源臨時添加上去)
export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/dist

這樣就可以找到合適版本的nodejs了.
nodejs可執行程序路徑(./licode/build/libdeps/nvm/versions/node/v6.14.4/bin/)
注: iojs版本對應的是(./licode/build/libdeps/nvm/versions/io.js/vx.x.x/bin)
npm是安裝node時一塊兒安裝的.是和node綁定的. 在node可執行程序對應的路徑下.
npm的可執行程序路徑(./licode/build/libdeps/nvm/versions/node/v6.14.4/bin/)
npm使用的源默認是國外的, 速度可能很慢, 很容易發生中連接失敗中斷錯誤.
我嘗試更換國內源
1 # 更換源地址, 如國內源: https://registry.npm.taobao.org 2 npm config set registry 源的訪問地址 3 4 # 查看配置源地址 5 npm config get registry
注: 1. 更換源地址使用絕對路徑或相對路徑(保證使用的是licode下的npm), 否則直接用npm命令使用的是系統的npm, 而不是licode的npm.
2. 使用tabao源雖然解決了6.14.4版本問題, 但是發現后面的過程很慢很慢, 反而換成原來的很快.
安裝conan部分
conan錯誤, 這個是安裝conan錯誤, 首先去python的dist-packages目錄下, 刪除setuptools-3.3.egg-info文件夾, 然后再使用pip命令下載setuptools, 后面的就交給licode的安裝腳本就行了.

pip3 install setuptools -U Downloading setuptools-41.2.0-py2.py3-none-any.whl (576kB): 576kB downloaded Installing collected packages: setuptools Found existing installation: setuptools 3.3 Not uninstalling setuptools at /usr/lib/python3/dist-packages, owned by OS Successfully installed setuptools Cleaning up... root@ubuntu:~/licode# cd /usr/lib/python3/dist-packages/ root@ubuntu:/usr/lib/python3/dist-packages# sudo rm -fr setuptools-3.3.egg-info/ root@ubuntu:~/licode# pip3 install setuptools -U
下載的各種依賴環境(都是腳本自動下載安裝的, 可能有些因網絡問題等會失敗,可以自行下載對應壓縮包放入對應路徑):
詳細大小:

第一步./scripts/installUbuntuDeps.sh執行成功.

或者

第二步./scripts/installNuve.sh執行成功

第三步 ./scripts/installErizo.sh
編譯時遇到錯誤: 提示識別錯誤, ld共享庫損壞

執行ld -v 查看版本

更新ld.
1 apt-get update 2 apt-get install binutils-2.26 3 // 默認是把新版本的安裝到了 /usr/lib/binutils-2.26/ 下了, 把舊的/usr/bin/ld 備份, 建立新的軟連接 /usr/bin/ld --> /usr/lib/binutils-2.26/bin/ld 4 5 // 也可以用源碼安裝(源碼安裝三部曲): 6 // 源碼地址: https://ftp.gnu.org/gnu/binutils/ 7 // ./configure --prefix=/xx/xx 執行configure時添加安裝路徑.
更新后查看版本

下載nodejs的header
下載nodejs的header失敗, 其實這個是源的問題,因為國外源, 導致訪問不到.( 另因: 我手動點這個地址, 發現進去需要輸入驗證碼, 很有可能是因為需要輸入驗證碼, 才導致找不到資源.)

在node-gyp可執行程序的路徑下執行如下命令手動下載安裝(通過國內源下載) (路徑:./licode/build/libdeps/nvm/versions/node/v6.14.4/bin/)
1 ./node-gyp install --dist-url https://npm.taobao.org/mirrors/node
執行成功打印

注: node-gyp文檔地址: https://www.npmjs.com/package/node-gyp
第三步 ./scripts/installErizo.sh 執行成功.

不常見錯誤:
執行npm時可能出現的報錯:
報錯: CERT_UNTRUSTED
解決辦法: ssl驗證問題,使用下面的命令取消ssl驗證即可解決 npm config set strict-ssl false
nvm相關
nvm的github地址: https://github.com/nvm-sh/nvm
nvm 常用命令
● nvm install stable 安裝最新穩定版 node
● nvm install <version> 安裝指定版本,如:安裝v4.4.0,nvm install v4.4.0
● nvm uninstall <version> 刪除已安裝的指定版本,語法與install類似
● nvm use <version> 切換使用指定的版本node
● nvm ls 列出所有安裝的版本
● nvm alias default <version> 如: nvm alias default v11.1.0
其它
window 打開瀏覽器
cmd /c start http://www.baidu.com
linux打開瀏覽器
x-www-browser http://www.baidu.com
中科大源
http://npmreg.mirrors.ustc.edu.cn
-----------------------------------------------------------------------------------------------------
目前通過谷歌瀏覽器和69版本的火狐瀏覽器無法使用攝像頭采集, 也不能正常拉流, 推測是因為安全問題, 需要使用https才能正常使用.
