Media Server Installation

Install Docker

Docker will be the container of Kurento-Media-Server, wich we´ll need for micro-audio, cam,recordings and share desktop.

Update the system:

sudo apt update

Install some needed packets:

sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

..add the GPG key for the oficial Docker repo:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

…and now add the repo to our APT:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu
$(lsb_release -cs) stable"

…update to take effect the changes:

sudo apt update

…and now to be sure Docker will be installed from the repo we´ve added, run this command:

apt-cache policy docker-ce

…must show something similar to this:

docker-ce:
  Installed: 5:23.0.4-1~ubuntu.20.04~focal
  Candidate: 5:24.0.2-1~ubuntu.20.04~focal
  Version table:
     5:24.0.2-1~ubuntu.20.04~focal 500
        500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages

…and install Docker:

sudo apt install docker-ce -y

…we check that the installation was right and is running:

sudo systemctl status docker

…and will show something similar to this:

● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2024-09-22 20:52:59 CST; 4min 21s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 962 (dockerd)
      Tasks: 8
     Memory: 100.0M
     CGroup: /system.slice/docker.service
             └─962 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Docker Image

The default config of LLMeetings and Kurento Media Server is a 1:1 mapping. Each LLMeetings instance is mapped exactly to 1 KMS instance as well as LLMeetings and KMS running on the same host.

The quickest and easiest way to run KMS is via Docker. But running the following commands you can run KMS locally only if you are an experienced docker user.

// for example /home/$user/work/openmeetings
export OM_HOME=$YOUR_PATH
// for example export OM_HOME=/Users/wagns1/Documents/openmeetings/_REPO/openmeetings \
/op enmeetings-web/target/openmeetings-web-5.0.0-M5-SNAPSHOT
docker run -v $OM_HOME/data:$OM_HOME/data -p 8888:8888 kurento/kurento-media-server

Each instance of LLMeetings requires a running Kurento Media Server (KMS). There is a complete list of installation modes here:  Install Kurento Media server.

The kurento-media-server Docker image is a nice all-in-one package for an easy quick start. It comes with all the default settings, which is enough to let you try the Tutorials.

If you need to insert or extract files from a Docker container, there is a variety of methods: You could use a bind mount; a volume; cp some files from an already existing container; change your ENTRYPOINT to generate or copy the files at startup; or base FROM this Docker image and build a new one with your own customizations. Check Kurento in Docker for an example of how to use bind-mounts to provide your own configuration files.

These are the exact contents of the image:

  • A local apt-get installation of KMS, as described in Local Installation, plus all its extra plugins (chroma, platedetector, etc).
  • Debug symbols installed, as described in Install debug symbols. This allows getting useful stack traces in case the KMS process crashes. If this happens, please report a bug.
  • All default settings from the local installation, as found in /etc/kurento. For details, see Configuration.
Running

Docker allows to fine-tune how a container runs, so you’ll want to read the Docker run reference and find out the command options that are needed for your project.

This is a good starting point, which runs the latest Kurento Media Server image with default options:

docker pull kurento/kurento-media-server:7.1.0

docker run -d --name kurento --network host kurento/kurento-media-server:7.1.0

By default, KMS listens on the port 8888. Clients wanting to control the media server using the Kurento Protocol should open a WebSocket connection to that port, either directly or by means of one of the provided Client API Reference SDKs.

The health checker script inside this Docker image does something very similar in order to check if the container is healthy.

Once the container is running, you can get its log output with the docker logs command:

docker logs --follow kms >"kms-$(date '+%Y%m%dT%H%M%S').log" 2>&1

For more details about KMS logs, check Debug Logging.

Why host networking

Notice how our suggested docker run command uses – – network host? Using Host Networking is recommended for software like proxies and media servers, because otherwise publishing large ranges of container ports would consume a lot of memory. You can read more about this issue in our Troubleshooting Guide.

The Host Networking driver only works on Linux hosts, so if you are using Docker for Mac or Windows then you’ll need to understand that the Docker network gateway acts as a NAT between your host and your container. To use KMS without STUN (e.g. if you are just testing some of the Tutorials) you’ll need to publish all required ports where KMS will listen for incoming data.

For example, if you use Docker for Mac and want to have KMS listening on the UDP port range [5000, 5050] (thus allowing incoming data on those ports), plus the TCP port 8888 for the Client API Reference, run:

docker run --rm \
    -p 8888:8888/tcp \
    -p 5000-5050:5000-5050/udp \
    -e KMS_MIN_PORT=5000 \
    -e KMS_MAX_PORT=5050 \
    kurento/kurento-media-server:7.1.0
Docker Upgrade

One of the nicest things about the Docker deployment method is that changing versions, or upgrading, is almost trivially easy. Just pull the new image version and use it to run your new container:

# Download the new image version:
docker pull kurento/kurento-media-server:7.1.0

# Create a new container based on the new version of KMS:
docker run [...] kurento/kurento-media-server:7.1.0

Local Installation

We highly recommend local installation option in product environment. With this method, you will install Kurento Media Server from the native Ubuntu packages built by the team.

Officially supported platforms: Ubuntu 24.04 (noble) (64-bits).

Open a terminal and run these commands:

  1. Make sure that GnuPG is installed.
sudo apt-get update ; sudo apt-get install --no-install-recommends gnupg
  1. Add the Kurento repository to your system configuration. Run these commands:
# Get DISTRIB_* env vars.
source /etc/upstream-release/lsb-release 2>/dev/null || source /etc/lsb-release

# Add Kurento repository key for apt-get.
sudo apt-key adv \
    --keyserver hkp://keyserver.ubuntu.com:80 \
    --recv-keys 234821A61B67740F89BFD669FC8A16625AFA7A83

# Add Kurento repository line for apt-get.
sudo tee "/etc/apt/sources.list.d/kurento.list" >/dev/null <<EOF
# Kurento Media Server - Release packages
deb [arch=amd64] http://ubuntu.openvidu.io/7.1.0 $DISTRIB_CODENAME main
EOF
  1. Install KMS

Note:This step applies only for a first time installation. If you already have installed Kurento and want to upgrade it, follow instead the steps described here: Local Upgrade.

sudo apt-get update ; sudo apt-get install --no-install-recommends \
    kurento-media-server

This will install the release version of Kurento Media Server.

Local Upgrade

To upgrade a local installation of Kurento Media Server, you have to write the new version number into the file /etc/apt/sources.list.d/kurento.list, which was created during Local Installation. After editing that file, you can choose between 2 options to actually apply the upgrade:

A. Upgrade all system packages.

This is the standard procedure expected by Debian & Ubuntu maintainer methodology. Upgrading all system packages is a way to ensure that everything is set to the latest version, and all bug fixes & security updates are applied too, so this is the most recommended method:

sudo apt-get update ; sudo apt-get dist-upgrade

However, don’t do this inside a Docker container. Running apt-get upgrade or apt-get dist-upgrade is frowned upon by the Docker best practices; instead, you should just move to a newer version of the Kurento Docker images.

B. Uninstall the old Kurento version, before installing the new one.

Note however that apt-get is not good enough to remove all of Kurento packages. We recommend that you use aptitude for this, which works much better than apt-get:

sudo aptitude remove '?installed?version(kurento)'

sudo apt-get update ; sudo apt-get install --no-install-recommends \
    kurento-media-server