Jitsi开源Web视频会议-安装篇

Jitsi是安全、简单和可伸缩的视频会议,您可以作为一个独立的应用程序或嵌入到您的web应用程序中。它是基于Prosody之上实现的,按照官方文档安装会出现一些问题,经过一些实验成功安装,并记录下安装步骤。

安装环境

  • Env: ubuntu 18.04
  • User: root

安装Prosody

1
2
3
4
echo deb http://packages.prosody.im/debian $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list
wget https://prosody.im/files/prosody-debian-packages.key -O- | sudo apt-key add -
apt-get update
apt-get install prosody

配置/etc/prosody/conf.d/meet.demo.com.cfg.lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-- Plugins path gets uncommented during jitsi-meet-tokens package install - that's where token plugin is located
--plugin_paths = { "/usr/share/jitsi-meet/prosody-plugins/" }

VirtualHost "meet.demo.com"
authentication = "anonymous"
ssl = {
key = "/var/lib/prosody/meet.demo.com.key";
certificate = "/var/lib/prosody/meet.demo.com.crt";
}
modules_enabled = {
"bosh";
"pubsub";
}
c2s_require_encryption = false

VirtualHost "auth.meet.demo.com"
ssl = {
key = "/var/lib/prosody/auth.meet.demo.com.key";
certificate = "/var/lib/prosody/auth.meet.demo.com.crt";
}
authentication = "internal_plain"

admins = { "focus@auth.meet.demo.com" }

Component "conference.meet.demo.com" "muc"
Component "jitsi-videobridge.meet.demo.com"
component_secret = "password1"
Component "focus.meet.demo.com"
component_secret = "password2"

证书生成

1
2
3
4
5
6
prosodyctl cert generate meet.demo.com
prosodyctl cert generate auth.meet.demo.com
output: /var/lib/prosody/

ln -sf /var/lib/prosody/auth.meet.demo.com.crt /usr/local/share/ca-certificates/auth.meet.demo.com.crt
update-ca-certificates -f

注册用户

1
prosodyctl register focus auth.meet.demo.com password3

重启服务

1
prosodyctl restart

安装Nginx

1
apt-get install nginx

配置/etc/nginx/sites-enabled/meet.demo.com

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
server {
listen 80;
server_name meet.demo.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name meet.demo.com;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA256:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EDH+aRSA+AESGCM:EDH+aRSA+SHA256:EDH+aRSA:EECDH:!aNULL:!eNULL:!MEDIUM:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SEED";

ssl_certificate /var/lib/prosody/meet.demo.com.crt;
ssl_certificate_key /var/lib/prosody/meet.demo.com.key;

root /var/www/jitsi-meet;
index index.html index.htm;
# error_page 404 /static/404.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;
}
}

重启服务

1
2
3
nginx -t

systemctl restart nginx

安装Jitsi Videobridge

下载jdk1.8(jdk-8u171-linux-x64.tar.gz),不能使用openjdk和default-jre

1
2
3
4
5
6
7
8
9
mkdir -p /usr/share/jdk
cd /usr/share/jdk
tar zxvf jdk-8u171-linux-x64.tar.gz

vi ~/.bashrc
export JAVA_HOME=/usr/share/jdk/jdk1.8.0_171
export PATH=$JAVA_HOME/bin:$PATH

java -version

下载Jitsi Videobridge

1
2
3
4
5
6
7
mkdir -p /root/jitsi
cd /root/jitsi
wget https://download.jitsi.org/jitsi-videobridge/linux/jitsi-videobridge-linux-x64-1055.zip
unzip jitsi-videobridge-linux-x64-1055.zip
mv jitsi-videobridge-linux-x64-1055 videobridge

cd videobridge

配置Jitsi Videobridge

添加启动脚本start.sh

1
2
3
4
5
6
7
8
9
#!/bin/bash

export JAVA_SYS_PROPS="-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=/etc/jitsi -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=videobridge -Dnet.java.sip.communicator.SC_LOG_DIR_LOCATION=/var/log/jitsi/videobridge -Djava.util.logging.config.file=/etc/jitsi/videobridge/logging.properties -Dlog4j.configurationFile=/etc/jitsi/videobridge/log4j2.xml"

./jvb.sh --host=localhost --domain=meet.demo.com --port=5347 --secret=password1 &

unset JAVA_SYS_PROPS

chmod +x start.sh

配置文件

1
2
mkdir -p /etc/jitsi/videobridge
cd /etc/jitsi/videobridge

添加logging.properties 到 /etc/jitsi/videobridge

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
handlers= java.util.logging.FileHandler
#handlers= java.util.logging.ConsoleHandler
#handlers= java.util.logging.ConsoleHandler, com.agafua.syslog.SyslogHandler

java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter = net.java.sip.communicator.util.ScLogFormatter

net.java.sip.communicator.util.ScLogFormatter.programname=JVB

.level=INFO

org.jitsi.videobridge.xmpp.ComponentImpl.level=FINE

# All of the INFO level logs from MediaStreamImpl are unnecessary in the context of jitsi-videobridge.
org.jitsi.impl.neomedia.MediaStreamImpl.level=WARNING

# Syslog(uncomment handler to use)
com.agafua.syslog.SyslogHandler.transport = udp
com.agafua.syslog.SyslogHandler.facility = local0
com.agafua.syslog.SyslogHandler.port = 514
com.agafua.syslog.SyslogHandler.hostname = localhost
com.agafua.syslog.SyslogHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
com.agafua.syslog.SyslogHandler.escapeNewlines = false

# to disable double timestamps in syslog uncomment next line
#net.java.sip.communicator.util.ScLogFormatter.disableTimestamp=true

java.util.logging.FileHandler.level = ALL
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.limit=1024000
java.util.logging.FileHandler.count=10
java.util.logging.FileHandler.pattern=/var/log/jitsi/videobridge/jvb%u.log
java.util.logging.FileHandler.append=true

添加 log4j2.xml 到 /etc/jitsi/videobridge

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Properties>
<Property name="log-path">/var/log/jitsi/videobridge</Property>
</Properties>
<Appenders>
<RollingFile name="RollingFile" fileName="${log-path}/cs.log"
filePattern="${log-path}/$${date:yyyy-MM}/cs-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout pattern="%d %-5p (%F:%L) - %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="250 MB"/>
</Policies>
</RollingFile>
<!--
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p (%F:%L) - %m%n"/>
</Console>
-->
</Appenders>
<Loggers>
<!--<Logger name="org.apache.log4j.xml" level="debug"/>-->
<Logger name="org.apache.log4j.xml" level="info"/>
<Root level="info">
<AppenderRef ref="RollingFile"/>
<!-- <AppenderRef ref="STDOUT"/> -->
</Root>
</Loggers>
</Configuration>

添加 sip-communicator.properties 到 /etc/jitsi/videobridge

1
org.jitsi.impl.neomedia.transform.srtp.SRTPCryptoContext.checkReplay=false

启动服务

1
2
3
mkdir -p /var/log/jitsi/videobridge
cd /root/jitsi/videobridge
./start.sh

安装Jitsi Jicofo

1
2
3
4
5
6
7
apt-get install  maven

cd /root/jitsi
git clone https://github.com/jitsi/jicofo.git
cd jicofo
mvn package -DskipTests -Dassembly.skipAssembly=false
unzip target/jicofo-linux-x64-1.1-SNAPSHOT.zip

配置

1
2
mkdir -p /etc/jitsi/jicofo
cd /etc/jitsi/jicofo

添加 logging.properties 到 /etc/jitsi/jicofo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
handlers= java.util.logging.FileHandler
#handlers= java.util.logging.ConsoleHandler
#handlers= java.util.logging.ConsoleHandler, com.agafua.syslog.SyslogHandler

java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter = net.java.sip.communicator.util.ScLogFormatter

net.java.sip.communicator.util.ScLogFormatter.programname=Jicofo

.level=INFO
net.sf.level=SEVERE
net.java.sip.communicator.plugin.reconnectplugin.level=FINE
org.ice4j.level=SEVERE
org.jitsi.impl.neomedia.level=SEVERE

# Do not worry about missing strings
net.java.sip.communicator.service.resources.AbstractResourcesService.level=SEVERE

#net.java.sip.communicator.service.protocol.level=ALL

# Enable debug packets logging
#org.jitsi.impl.protocol.xmpp.level=FINE

# Syslog(uncomment handler to use)
com.agafua.syslog.SyslogHandler.transport = udp
com.agafua.syslog.SyslogHandler.facility = local0
com.agafua.syslog.SyslogHandler.port = 514
com.agafua.syslog.SyslogHandler.hostname = localhost
com.agafua.syslog.SyslogHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
com.agafua.syslog.SyslogHandler.escapeNewlines = false

# to disable double timestamps in syslog uncomment next line
#net.java.sip.communicator.util.ScLogFormatter.disableTimestamp=true

# uncomment to see how Jicofo talks to the JVB
#org.jitsi.impl.protocol.xmpp.colibri.level=ALL


java.util.logging.FileHandler.level = ALL
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.limit=1024000
java.util.logging.FileHandler.count=10
java.util.logging.FileHandler.pattern=/var/log/jitsi/jicofo/jicofo%u.log
java.util.logging.FileHandler.append=true

添加 log4j2.xml 到 /etc/jitsi/jicofo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Properties>
<Property name="log-path">/var/log/jitsi/jicofo</Property>
</Properties>
<Appenders>
<RollingFile name="RollingFile" fileName="${log-path}/cs.log"
filePattern="${log-path}/$${date:yyyy-MM}/cs-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout pattern="%d %-5p (%F:%L) - %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="250 MB"/>
</Policies>
</RollingFile>
<!--
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p (%F:%L) - %m%n"/>
</Console>
-->
</Appenders>
<Loggers>
<!--<Logger name="org.apache.log4j.xml" level="debug"/>-->
<Logger name="org.apache.log4j.xml" level="info"/>
<Root level="info">
<AppenderRef ref="RollingFile"/>
<!-- <AppenderRef ref="STDOUT"/> -->
</Root>
</Loggers>
</Configuration>

添加 sip-communicator.properties 到 /etc/jitsi/jicofo (empty file)

启动脚本
cd /root/jitsi/jicofo

添加 start.sh 到 /root/jitsi/jicofo

1
2
3
4
5
6
7
8
9
10
#!/bin/bash

# mvn package -DskipTests -Dassembly.skipAssembly=false


export JAVA_SYS_PROPS="-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=/etc/jitsi -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=jicofo -Dnet.java.sip.communicator.SC_LOG_DIR_LOCATION=/var/log/jitsi/jicofo -Djava.util.logging.config.file=/etc/jitsi/jicofo/logging.properties -Dlog4j.configurationFile=/etc/jitsi/jicofo/log4j2.xml"

./jicofo-linux-x64-1.1-SNAPSHOT/jicofo.sh --host=localhost --domain=meet.demo.com --secret=password2 --user_domain=auth.meet.demo.com --user_name=focus --user_password=password3 &

unset JAVA_SYS_PROPS

启动服务

1
2
3
4
chmod +x start.sh

mkdir -p /var/log/jitsi/jicofo/
./start.sh

安装Jitsi Meet

编译

1
2
3
4
5
6
cd /root/jitsi
git clone https://github.com/jitsi/jitsi-meet.git

npm install

make

配置

1
2
cp -fr jitsi-meet /var/www/
cd /var/www/jitsi-meet

修改config.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var config = {
hosts: {
domain: 'meet.demo.com',
muc: 'conference.meet.demo.com',
bridge: 'jitsi-videobridge.meet.demo.com',
focus: 'focus.meet.demo.com'
},
useNicks: false,
bosh: '//meet.demo.com/http-bind', // FIXME: use xep-0156 for that
//chromeExtensionId: 'diibjkoicjeejcmhdnailmkgecihlobk', // Id of desktop streamer Chrome extension
//minChromeExtVersion: '0.1' // Required version of Chrome extension
};

check /etc/nginx/sites-enabled/meet.demo.com root
root /var/www/jitsi-meet;

重启服务

1
systemctl restart nginx

浏览器中输入:https://meet.demo.com/