By this article you can figure out how Janus gateway install in ubuntu 18.04 correctly.

First of all we will update our ubuntu instance.

sudo apt-get update

Then you can install required dependencies using below code block.

sudo apt-get install git libmicrohttpd-dev libjansson-dev libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev libopus-dev libogg-dev libcurl4-openssl-dev liblua5.3-dev libconfig-dev pkg-config gengetopt libtool automake gtk-doc-tools cmake

after installing above dependencies you will need download and compile manually some other dependencies.

libnice

     git clone https://gitlab.freedesktop.org/libnice/libnice
	 cd libnice
	 ./autogen.sh
	 ./configure --prefix=/usr
	 make && sudo make install

You can follow above code block as one by one or, put them into file called, install_libnice.sh
as below,

#!/bin/bash

# install_libnice.sh
git clone https://gitlab.freedesktop.org/libnice/libnice
cd libnice
./autogen.sh
./configure --prefix=/usr
make && sudo make install

and run,

bash install_libnice.sh

You can use this way to all of following code blocks also.

libsrtp

   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

You can use any of above mentioned ways to install this.

usrsctp

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

libwebsockets

git clone https://github.com/warmcat/libwebsockets.git
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

There is some other optional dependencies to install if you use those in your application.

MQTT (Optional)

git clone https://github.com/eclipse/paho.mqtt.c.git
cd paho.mqtt.c
sudo prefix=/usr make install

NanoMSG (Optional)

sudo apt-get install libnanomsg-dev

RabbitMQ C AMQP (optional)

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

After installing above all dependencies we can move to compile Janus.

First we can clone the source code and move to directory.

git clone https://github.com/meetecho/janus-gateway.git
cd janus-gateway

Then generate configuration file.

sh autogen.sh

Now, using following command you can initialize a default Janus instance with almost everything that you need to get started.

./configure --prefix=/opt/janus

After that you can follow below code blocks,

make
make install

Don't forget as well only the first time of building Janus, to copy the default configuration files on the installation path with the following command:

make configs

Finally, you can check that, is this working by below code.

/opt/janus/bin/janus --help