Thursday, June 29, 2017

Building Janus Gateway on ubuntu 16

I already tried to build janus on centos as I am more familiar with it, but for some reasons regarding the kernel version, build always failed.

I moved to Ubuntu and build was straightforward in development stage.

But, when project gone in beta, and I started to receive some clients, a socket error started to crash janus as I am using secure web socket protocol (more details here).

Forum discussion led to rebuild libwebsockets library with option -DLWS_MAX_SMP=1 as there is multi threading issue, you can search and get more information about this option, also you can get more information about the bug here in janus github issues.


Anyway the following are the final working steps for building janus gateway on ubuntu 16 / 64 box.

1- build libsrtp

wget https://github.com/cisco/libsrtp/archive/v2.0.0.tar.gz
tar xfv v2.0.0.tar.gz
cd libsrtp-2.0.0
./configure --prefix=/usr --enable-openssl
make shared_library && sudo make install

1 - Rebuild libwebsockets using -DLWS_MAX_SMP=1 option

sudo apt-get install git cmake
sudo apt-get remove libwebsockets-dev

sudo git clone https://github.com/warmcat/libwebsockets.git
sudo apt-get install libssl-dev

cd /
mkdir build
cd build

git clone https://github.com/warmcat/libwebsockets.git

cd libwebsockets

cmake -DLWS_MAX_SMP=1 .
make
sudo make install
ldconfig



2- Build Janus Gateway

sudo apt-get upgrade


sudo apt-get install libmicrohttpd-dev libjansson-dev libnice-dev libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev libopus-dev libogg-dev libini-config-dev libcollection-dev pkg-config gengetopt automake libtool doxygen graphviz git cmake

sudo apt-get install libavformat-dev

mkdir -p ~/build
cd ~/build
git clone git://github.com/meetecho/janus-gateway.git
cd janus-gateway
sh autogen.sh
./configure --disable-data-channels --disable-rabbitmq --disable-docs --prefix=/opt/janus LDFLAGS="-L/usr/local/lib -Wl,-rpath=/usr/local/lib" CFLAGS="-I/usr/local/include"

make && sudo make install
sudo make configs



------------------
* *  Notice that --disable-data-channels --disable-rabbitmq --disable-docs are optional, and you should read about all options from here .

** You will find Janus installation in /opt/janus and configuration files should be here /opt/janus/etc/janus

Good Luck!


2 comments:

  1. Hi,

    Have you tried the latest master version on 17.x ? It seems there are some problems and Janus is crashing on connecting clients.

    Thanks!,

    Matt

    ReplyDelete
    Replies
    1. Welcome Yamakasi,
      All I remember, I faced many crash issues with ssl compile, Until I used nginx as proxy to ws://janus instead of wss:// connection.

      Delete