centos部署janus -(CentOS 7.6安装janus v0.10.10)

Janus系列文章 CentOS 7.6 部署

  • 前言
  • 一、Janus是什么?
  • 二、安装步骤
    • 1.安装依赖包
    • 2.安装gcc版本7
    • 3.安装python3
    • 4.安装ICE库
    • 5.安装SRTP库
    • 6.安装cmake3
    • 7.安装data-channel支持
    • 8.安装WebSocket库
    • 9.安装libmicrohttpd
    • 10.安装janus-gateway
      • 生成配置文件
    • 11.试一下安装OK不
  • 总结
  • 相关文章

centos部署janus -(CentOS 7.6安装janus v0.10.10)_第1张图片
centos部署janus -(CentOS 7.6安装janus v0.10.10)_第2张图片


前言

之前的文章向大家介绍了用WebRTC实现web端P2P的通讯实现,我们接下来的目标是在web端实现多点通讯,做一个视频会议室和直播实现,P2P的mesh拓扑结构做多对多的视频通话的时候不可取,因为mesh结构对客户端侧的上下行带宽压力太大,还有其它的一些弊端,实际应用场景下难以落地使用。一般我们都需要在MCU和SFU中选择一个方案来做多点通讯,而SFU更有优势的方案。
在对比了当前一些主流的SFU服务器里我选择了Janus来做WebRTC 网关,原因如下:1、Janus是由一家叫Meetecho专业公司开发的开源产品,团队也一直在更新Janus,2、在国内用的相对来说比较多遇到问题容易交流,3、官方文档全面,4、官方对各个功能(视频房、屏幕共享、直播)的demo,方便新手上手


提示:这里博主使用的是一台全新的服务器实例来进行演示

一、Janus是什么?

Janus(Janus Gateway):通用WebRTC服务器,主要用于做SFU架构的WebRTC网关。

二、安装步骤

环境 版本
CentOS(公网IP服务器) 7.6
Janus v0.10.10

这里博主使用的是一台全新的服务器实例来进行演示

1.安装依赖包

$ yum install libmicrohttpd-devel jansson-devel \
   openssl-devel libsrtp-devel sofia-sip-devel glib2-devel \
   opus-devel libogg-devel libcurl-devel pkgconfig gengetopt \
   libconfig-devel libtool autoconf git automake lksctp-tools.i686 lksctp-tools-devel.x86_64 lksctp-tools-devel.i686

2.安装gcc版本7

下面要用到的一些依赖库需要gcc 7才能成功编译,centos7自带的4.8版本不行,所以我们把它升级下。

sudo yum install centos-release-scl
sudo yum install scl-utils-build

sudo yum install devtoolset-7-gcc*
sudo yum install devtoolset-7-gdb*

scl enable devtoolset-7 bash

which gcc

gcc --version

3.安装python3

python3是下面依赖库要用到的一些编译脚本需要。
有些服务器是自带了python3就不需要再升级了

$ python3 --version
Python 3.6.8

4.安装ICE库

yum install meson

git clone https://gitee.com/mirrors/libnice

cd libnice

meson --prefix=/usr build && ninja -C build && sudo ninja -C build install

5.安装SRTP库

cd

wget https://github.com/cisco/libsrtp/archive/v1.5.4.tar.gz

tar xfv v1.5.4.tar.gz

cd libsrtp-1.5.4

./configure --prefix=/usr --enable-openssl

make shared_library && sudo make install


cd

wget https://github.com/cisco/libsrtp/archive/v2.2.0.tar.gz

tar xfv v2.2.0.tar.gz

cd libsrtp-2.2.0

./configure --prefix=/usr --enable-openssl --libdir=/usr/lib64

make shared_library && sudo make install

6.安装cmake3

cd

yum install cmake3 -y
# (   cmake 需要3.5以上的版本
Istalled:
  cmake3.x86_64 0:3.17.5-1.el7
)

ln -s /usr/bin/cmake3 /usr/bin/cmake

7.安装data-channel支持

cd

git clone https://gitee.com/whatitis/usrsctp.git
cd usrsctp
./bootstrap
./configure --prefix=/usr --disable-programs --disable-inet --disable-inet6
make && sudo make install

8.安装WebSocket库

cd

git clone https://gitee.com/whatitis/libwebsockets.git

cd libwebsockets
# If you want the stable version of libwebsockets, uncomment the next line
# git checkout v3.2-stable
git checkout v3.2-stable
mkdir build
cd build
# See https://github.com/meetecho/janus-gateway/issues/732 re: LWS_MAX_SMP
# See https://github.com/meetecho/janus-gateway/issues/2476 re: LWS_WITHOUT_EXTENSIONS

cmake -DLWS_MAX_SMP=1 -DLWS_WITHOUT_EXTENSIONS=0 -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_C_FLAGS="-fpic" ..

make && sudo make install

9.安装libmicrohttpd

用于janus提供http服务

cd

wget https://ftp.gnu.org/gnu/nettle/nettle-3.4.tar.gz
tar zxvf nettle-3.4.tar.gz
cd nettle-3.4

./configure --prefix=/usr/
make
make check #测试一下
make install

cd

wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.5/gnutls-3.5.9.tar.xz
tar xvf gnutls-3.5.9.tar.xz
cd gnutls-3.5.9
PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig 
./configure --with-included-libtasn1 --with-included-unistring --without-p11-kit
sudo make && sudo make install


cd
wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.71.tar.gz
tar zxf libmicrohttpd-0.9.71.tar.gz
cd libmicrohttpd-0.9.71/

 # ./configure --prefix=/usr/lib64 --with-ssl  --enable-https=yes
./configure --with-ssl  --enable-https=yes

# ------------ 可用模块目录 --------------
configure: GNU libmicrohttpd 0.9.71 Configuration Summary:
  Target directory:  /usr/lib64
  Cross-compiling:   no
  Operating System:  linux-gnu
  Shutdown of listening socket trigger select: yes
  Inter-thread comm: eventfd
  poll support:      yes
  epoll support:     yes
  sendfile used:     yes, Linux-style
  HTTPS support:     yes (using libgnutls)
  Threading lib:     posix
  Use thread names:  yes
  Use debug asserts: no
  Messages:          yes
  Gettext:           yes
  Basic auth.:       yes
  Digest auth.:      yes
  HTTP "Upgrade":    yes
  Postproc:          yes
  Build docs:        yes
  Build examples:    yes
  Test with libcurl: yes

configure: HTTPS subsystem configuration:
  License         :  LGPL only


# ------------ 可用模块目录 --------------

make && sudo make install

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

10.安装janus-gateway

cd

git clone https://gitee.com/whatitis/janus-gateway.git

cd janus-gateway
git checkout v0.10.10
sh autogen.sh

./configure --prefix=/opt/janus --disable-docs --libdir=/usr/lib64 --enable-libsrtp2 --enable-websockets --enable-data-channels --enable-rest --disable-rabbitmq --disable-mqtt


Compiler:                  gcc
libsrtp version:           2.x
SSL/crypto library:        OpenSSL
DTLS set-timeout:          not available
Mutex implementation:      GMutex (native futex on Linux)
DataChannels support:      yes
Recordings post-processor: no
TURN REST API client:      yes
Doxygen documentation:     no
Transports:
    REST (HTTP/HTTPS):     yes
    WebSockets:            yes
    RabbitMQ:              no
    MQTT:                  no
    Unix Sockets:          yes
    Nanomsg:               no
Plugins:
    Echo Test:             yes
    Streaming:             yes
    Video Call:            yes
    SIP Gateway:           no
    NoSIP (RTP Bridge):    yes
    Audio Bridge:          yes
    Video Room:            yes
    Voice Mail:            yes
    Record&Play:           yes
    Text Room:             yes
    Lua Interpreter:       no
    Duktape Interpreter:   no
Event handlers:
    Sample event handler:  yes
    WebSocket ev. handler: yes
    RabbitMQ event handler:no
    MQTT event handler:    no
    Nanomsg event handler: no
    GELF event handler:    yes
External loggers:
    JSON file logger:      no
JavaScript modules:        no

If this configuration is ok for you, do a 'make' to start building Janus. A 'make install' will install Janus and its plugins to the specified prefix. Finally, a 'make configs' will install some sample configuration files too (something you'll only want to do the first time, though).



make && sudo make install


libtool: install: /usr/bin/install -c transports/.libs/libjanus_pfunix.lai /usr/lib/janus/transports/libjanus_pfunix.la
libtool: finish: PATH="/sbin:/bin:/usr/sbin:/usr/bin:/sbin" ldconfig -n /usr/lib/janus/transports
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib/janus/transports

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /usr/bin/mkdir -p '/opt/janus/include/janus/transports'
 /usr/bin/install -c -m 644 transports/transport.h '/opt/janus/include/janus/transports'
make[3]: Leaving directory `/root/janus-gateway'
make[2]: Leaving directory `/root/janus-gateway'
make[1]: Leaving directory `/root/janus-gateway'

生成配置文件


make configs

11.试一下安装OK不

[root@ecs-3624 janus]# pwd
/opt/janus
[root@ecs-3624 janus]# ls
bin  etc  include  share



[root@ecs-3624 janus]# bin/janus
Janus commit: 7732127f71521d1f1b305fdcf1073b3602f15b6e
Compiled on:  Tue Apr 13 17:09:44 CST 2021

Logger plugins folder: /usr/lib64/janus/loggers
[WARN]  Couldn't access logger plugins folder...
---------------------------------------------------
  Starting Meetecho Janus (WebRTC Server) v0.10.10
---------------------------------------------------


HTTP transport timer started
HTTP webserver started (port 8088, /janus path listener)...
JANUS REST (HTTP/HTTPS) transport plugin initialized!
Loading transport plugin 'libjanus_websockets.so'...
[WARN] libwebsockets has been built without IPv6 support, will bind to IPv4 only
libwebsockets logging: 0
WebSockets server started (port 8188)...
JANUS WebSockets transport plugin initialized!
Loading transport plugin 'libjanus_pfunix.so'...
[WARN] No Unix Sockets server started, giving up...
[WARN] The 'janus.transport.pfunix' plugin could not be initialized
WebSockets thread started

要看到http和websocket端口启动才算没有问题


总结

以上就是本文章要讲的内容,本文列出了CentOS下安装Janus的详细步骤,而Janus提供了一些比较实用的插件能使我们快速便捷地实现视频会议、直播、屏幕共享等服务。至于Janus的配置、API与相关插件的使用我会在后续的文章中逐步阐述。

相关文章

WebRTC 系列文章 WebRTC基本概念理解

WebRTC 系列文章 一对一视频通话和文字聊天

WebRTC 系列文章 文件共享

WebRTC 系列文章 ICE服务器搭建 coturn

你可能感兴趣的:(webrtc,sfu,centos,janus,流媒体)