Installation of Janus WebRTC Server on CentOS 7

Janus WebRTC Server is described as “Janus is a WebRTC Server developed by Meetecho conceived to be a general purpose one. As such, it doesn’t provide any functionality per se other than implementing the means to set up a WebRTC media communication with a browser, exchanging JSON messages with it, and relaying RTP/RTCP and messages between browsers and the server-side application logic they’re attached to.”

This article describes the installation procedure of Janus WebRTC Server on CentOS 7. Being a very complex and long process it is necessary to write on this due to the problems I faced during the installation of Janus on CentOS 7. Therefore, I documented all the steps and am sharing this with you guys to make life easier for you.

I am assuming that you are using a fresh server to install Janus WebRTC, however, if you are not, then please Do not forget to take a backup of your server if it is in production.

Let’s begin by updating the system.

sudo yum update

Enable the EPEL Repository.

sudo yum install epel-release

Now, we need to install the dependencies for Janus WebRTC.

Installation of Janus Dependencies using YUM and DNF

# Dependencies to be installed using yum.
sudo yum install openssl-devel glib2-devel opus-devel dnf libcurl-devel doxygen nginx dnf-plugins-core wget git meson ninja libmicrohttpd-devel libsrtp-devel libogg-devel libconfig-devel install jansson-devel libcurl-devel pkgconf-pkg-config libtool autoconf automake graphviz centos-release-scl

yum-config-manager --enable rhel-server-rhscl-7-rpms
yum install devtoolset-7 openssl11
scl enable devtoolset-7 bash

# Download and Install dnf forensics repository. 
wget -c https://forensics.cert.org/cert-forensics-tools-release-el8.rpm
rpm -Uvh cert-forensics-tools-release-el8.rpm

# Dependecies to be install using dnf forensics repository.
dnf --enablerepo=forensics install gengetopt

Installation of Janus Dependencies using Source Code

1. sofia-sip

cd /opt
wget -c https://downloads.sourceforge.net/project/sofia-sip/sofia-sip/1.12.11/sofia-sip-1.12.11.tar.gz
tar -xvf sofia-sip-1.12.11.tar.gz
cd sofia-sip-1.12.11
./configure
make
make install

2. libnice

cd /opt
git clone https://gitlab.freedesktop.org/libnice/libnice.git
cd libnice
meson builddir
ninja -C builddir
ninja -C builddir test
ninja -C builddir install
export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig

3. libsrtp

cd /opt
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
make shared_library && sudo make install

4. usrctp

cd /opt
git clone https://github.com/sctplab/usrsctp
cd usrsctp
./bootstrap
./configure --prefix=/usr && make && sudo make install

5. libwebsockets

cd /opt
git clone https://libwebsockets.org/repo/libwebsockets
cd libwebsockets
git checkout v2.4-stable
mkdir build
cd build
cmake -DLWS_MAX_SMP=1 -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_C_FLAGS="-fpic" ..
make && sudo make install

6. libpaho

cd /opt
git clone https://github.com/eclipse/paho.mqtt.c.git
cd paho.mqtt.c
make
make html
make install

7. cmake

cd /opt
wget https://cmake.org/files/v3.12/cmake-3.12.3.tar.gz
tar zxvf cmake-3.*
cd cmake-3.*
./bootstrap --prefix=/usr/local
make -j$(nproc)
make install

8. rabbitmq-c

cd /opt
git clone https://github.com/alanxz/rabbitmq-c
cd rabbitmq-c
git submodule init
git submodule update
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make && sudo make install

Installing Janus

cd /opt
git clone https://github.com/meetecho/janus-gateway.git
cd janus-gateway
./configure --prefix=/opt/janus
make
make install
make configs

Configuring Janus

Edit the Janus configuration File.

vi /opt/janus/etc/janus/janus.jcfg
# Uncomment the following line
daemonize = true
# Uncomment the following lines and enable Stun Server. 
stun_server = "stun1.l.google.com"
stun_port = 19302
# Uncomment the following lines and enable Turn Server and change TURN server to following (You may create your own account on numb.viagenie.ca - They provide free TURN Services)
turn_server = "numb.viagenie.ca"
turn_port = 3478
turn_type = "udp"
turn_user = "XXXXXXXXX" #### Create your own account
turn_pwd = "XXXXXXXXX" #### Enter password which u used while creating account

Enable HTTP / HTTPS Server

vi /opt/janus/etc/janus/janus.transport.http.jcfg
# set the following
http = true
https = true

Now start Janus WebRTC Server using the following command.

/opt/janus/bin/janus

Configuring NGINX Web Proxy to access Janus Demo Content

NGINX has been already installed above, furthermore, to access demo content we can use any Web Server. However, to configure NGINX perform the following steps.

Edit the NGINX configuration file.

vi /etc/nginx/nginx.conf
# Check to see if enabled on Port 80
listen 80 default_server;
# Set the server name
server_name janus.tuxpedia.net;  # Replace with your hostname

Copy demo data to NGINX Document Root.

cp -Rv /opt/janus/share/janus/demos/* /usr/share/nginx/html

Restart NGINX

service nginx restart

Install Let’s Encrypt SSL

apt-get install software-properties-common
add-apt-repository universe
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install certbot python-certbot-nginx
certbot --nginx

Now you can access Janus WebRTC on https://janus.yourdomain.com. You will be able to access all Demo Content with complete WebRTC functionality.

Final Thoughts on Janus WebRTC

After installation of Janus WebRTC, you can play around with the Demo Plugins and get an idea of how you will be using it for your own requirements.

Explore more posts related to CentOS here.

[rb_related title=”You May Also Like” total=”2″]

Leave a Reply