写在前面
jitsi是一个开源视频会议框架,简单易于安装,由于各种原因,公司需要搭建自己的jitsi环境,官方(jitsi.org)提供了三种安装方案:
1. 快速安装
2. 基于docker
3. 编译安装
我这边花了点时间把快速安装,编译安装在gong网上安装完成。
准备工作
* 阿里云或其他云服务器,建议至少2c4g,标准版
* ubuntu 18的系统
* ssl nginx版本有效证书下载
* 备案域名一个(也可使用公网ip,这篇文章假定的是www.iamcrawler.cn)
认识jitsi
- 首先我们来看一下jitsi要部署起来,都有哪些模块:
由上图可以知道,nginx是一个反向代理服务器,下面有4个模块是
属于jitsi的,其中jitsi-meet是前端;jicofo是后端,负责房间管
理相关信息;videobridge是后端视频桥(后面简称jvb),负责各个房间视频等信息
相互传输转换等信息;prosody是一个协议。那么如果我们手动编译,
主要的任务就是安装nginx,并启动下面4个模块即可
开始安装
- 安装prosody
apt-get install prosody
配置prosody
cd /etc/prosody/conf.avail
vim www.iamcrawler.cn.cfg.lua
内容如下:
===================www.iamcrawler.cn.cfg.lua开始============================
VirtualHost "www.iamcrawler.cn"
authentication = "anonymous"
ssl = {
key = "/var/lib/prosody/www.iamcrawler.cn.key";
certificate = "/var/lib/prosody/www.iamcrawler.cn.crt";
}
modules_enabled = {
"bosh";
"pubsub";
}
c2s_require_encryption = false
VirtualHost "auth.www.iamcrawler.cn"
ssl = {
key = "/var/lib/prosody/auth.www.iamcrawler.cn.key";
certificate = "/var/lib/prosody/auth.www.iamcrawler.cn.crt";
}
authentication = "internal_hashed"
admins = { "[email protected]" }
Component "conference.www.iamcrawler.cn" "muc"
Component "jitsi-videobridge.www.iamcrawler.cn"
component_secret = "YOURSECRET1"
Component "focus.www.iamcrawler.cn"
component_secret = "YOURSECRET2"
===================www.iamcrawler.cn.cfg.lua结束============================
至此,prosody配置结束,为了使配置生效,我们需要使用软连接把他加到conf.d下面(或者可以直接在主配置文件里面配置,是一样的额,这里是主配置文件includ的了):
ln -s /etc/prosody/conf.avail/www.iamcrawler.cn.cfg.lua /etc/prosody/conf.d/www.iamcrawler.cn.cfg.lua
接下来我们需要生成两个证书(生成证书的过程该怎么输入可以百度,很简单的)
prosodyctl cert generate www.iamcrawler.cn
prosodyctl cert generate auth.www.iamcrawler.cn
然后我们将自己生成的两个证书+自己阿里云的证书(根据自己的路径软连接就好了,我就不写了),软连接到服务器受信任的证书里面(官网只有一个,我只链接一个的时候两个人进就会断掉,目前我链接了三个):
ln -sf /var/lib/prosody/auth.www.iamcrawler.cn.crt /usr/local/share/ca-certificates/auth.www.iamcrawler.cn.crt
ln -sf /var/lib/prosody/www.iamcrawler.cn.crt /usr/local/share/ca-certificates/www.iamcrawler.cn.crt
使受信任的证书生效
update-ca-certificates -f
创建一个焦点用户
prosodyctl register focus auth.www.iamcrawler.cn YOURSECRET3
prosody配置完毕,然后重启
prosodyctl restart
- 安装nginx
apt-get install nginx
然后在/etc/nginx
路径下添加www.iancrawler.cn.conf
配置文件,配置如下
#server_names_hash_bucket_size 64;
server {
listen 443 ssl;
server_name www.iancrawler.cn;
ssl on;
ssl_certificate /cert/moos.crt; ##这是我阿里云生成的nginx证书
ssl_certificate_key /cert/moos.key; ##这是我阿里云生成的nginx密钥
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
# set the root
root /jitsi/jitsi-meet;
index index.html;
location ~ ^/([a-zA-Z0-9=\?]+)$ {
rewrite ^/(.*)$ / break;
}
location / {
ssi on;
}
# BOSH, Bidirectional-streams Over Synchronous HTTP
# https://en.wikipedia.org/wiki/BOSH_(protocol)
location /http-bind {
proxy_pass http://localhost:5280/http-bind;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
}
# external_api.js must be accessible from the root of the
# installation for the electron version of Jitsi Meet to work
# https://github.com/jitsi/jitsi-meet-electron
location /external_api.js {
alias /jitsi/jitsi-meet/libs/external_api.min.js;
}
}
server {
listen 80;
server_name moos.wiki;
# set the root
root /jitsi/jitsi-meet;
index index.html;
location ~ ^/([a-zA-Z0-9=\?]+)$ {
rewrite ^/(.*)$ / break;
}
location / {
ssi on;
}
# BOSH
location /http-bind {
proxy_pass http://localhost:5280/http-bind;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
}
# xmpp websockets
location /xmpp-websocket {
proxy_pass http://localhost:5280/xmpp-websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
tcp_nodelay on;
}
}
- 安装Jitsi Videobridge(jvb)
wget https://download.jitsi.org/jitsi-videobridge/linux/jitsi-videobridge-linux-x64-1132.zip
unzip jitsi-videobridge-linux-x64-1132.zip
新环境还要安装jre
apt-get install openjdk-8-jre
创建~/.sip-communicator/sip-communicator.properties
文件,如下(内网地址不知道的ifconfig就看到了)
mkdir -p ~/.sip-communicator
cat > ~/.sip-communicator/sip-communicator.properties << EOF org.jitsi.impl.neomedia.transform.srtp.SRTPCryptoContext.checkReplay=false
# The videobridge uses 443 by default with 4443 as a fallback, but since we're already
# running nginx on 443 in this example doc, we specify 4443 manually to avoid a race condition
org.jitsi.videobridge.TCP_HARVESTER_PORT=4443
org.ice4j.ice.harvest.NAT_HARVESTER_LOCAL_ADDRESS=(你的内网地址)
org.ice4j.ice.harvest.NAT_HARVESTER_PUBLIC_ADDRESS=(你的公网地址)
EOF
好了,安装好了以后可以后台启动jvb,并指定日志路径/var/log/jvb.log
/bin/bash /jitsi/jitsi-videobridge-linux-x64-1132/jvb.sh --host=localhost --domain=www.iamcrawler.cn --port=5347 --secret=YOURSECRET1 > /var/log/jvb.log 2>&1 &
- 安装jicofo
首先装一个maven,因为一会需要打包编译,需要下载n多个jar包
apt-get install openjdk-8-jdk maven
拉下代码
git clone https://github.com/jitsi/jicofo.git
打包编译(注意,mvn package 这一步可能会要很久很久,我package多次,没有低于1小时的,你就做好2个小时的准备吧,还有可能中途会出错,出错了,命令再来一次就好,一般会出1-2次错)
cd jicofo
mvn package -DskipTests -Dassembly.skipAssembly=false
好了,经过漫长等待,看到build success字样后,就是打包成功了。
我们开始跑jicofo吧
unzip target/jicofo-1.1-SNAPSHOT
cd jicofo-1.1-SNAPSHOT
/bin/bash /jitsi/jicofo/target/jicofo-1.1-SNAPSHOT/jicofo.sh --host=localhost --domain=www.iamcrawler.cn --secret=YOURSECRET2 --user_domain=auth.www.iamcrawler.cn --user_name=focus --user_password=YOURSECRET3 > /var/log/jicofo.log 2>&1 &
- 安装jitsi-meet
在一个不是root路径的地方,下载代码(主要是nginx会把index.html放上去),我都是放在/jitsi下面的。如果没有安装node,需要安装一下node,node的版本一定要大于12,低版本我已踩完坑...
node高版本安装:
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v
npm -v
下载代码
cd /jitsi
git clone https://github.com/jitsi/jitsi-meet.git
jitsi-meet修改连接本服务器后端入口vim jitsi-meet/config.js
var config = {
hosts:
{ domain: 'www.iamcrawler.cn',
muc: 'conference.www.iamcrawler.cn',
bridge: 'jitsi-videobridge.www.iamcrawler.cn',
focus: 'focus.www.iamcrawler.cn'
},
useNicks: false,
bosh: '//www.iamcrawler.cn/http-bind',
// FIXME: use xep-0156 for that
//chromeExtensionId: 'diibjkoicjeejcmhdnailmkgecihlobk',
// Id of desktop streamer Chrome extension //minChromeExtVersion: '0.1'
// Required version of Chrome extension
};
好了,配置好了,可以跑起来了
cd jitsi-meet
npm install
make
至此,官方四大件配置结束,这里我们还需要在安全组或者防火墙把相应端口打开
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 4443/tcp
sudo ufw allow 10000/udp
sudo ufw allow 22/tcp
sudo ufw allow 5347/tcp
sudo ufw allow 5222/tcp
sudo ufw enable
然后跑到你的阿里云上把上面的端口都打开,请注意,10000端口是udp不是tcp
然后编辑host
vim /etc/hosts
在最后添加你的127.0.0.1 localhost www.iamcrawler.cn
好了,使用https://www.iamcrawler.cn就可...,房间相关的日志配置在了/var/log/jicofo.log,视频桥相关的日志配置在了/var/log/jvb.log。
写在最后
花了一周多一点的时间,快速安装和编译安装都完成了,遇到问题的时候,可以多查一下,然后看一下人家怎么解决的,也可以把官方网站的教程多看几遍,官方网站都有详细的介绍,说明,包括配置(配置记得看他github上面的).
最后,转载请注明原处(https://segmentfault.com/a/11...。谢谢。