Skip to content

WCS in WSL 2

Windows SubSystem for Linux (WSL) is a Linux environment in Windows 10 and above. WSL 2 if a full-fledged Hyper-V virtual machine and supports a number of main Linux distros. This allows to deploy WCS on Windows PC to test

WSL installation

In latest Windows releases, use the following command with Administrator privilegies

wsl --install

This will require system reboot. By default, Ubuntu 20.04 will be installed. Use the following command to see all available distros

wsl --list --online

Choose the distro as follows:

wsl --install -d Ubuntu-18.04

Read Microsoft official documentation for details.

It is recommended to update installed packages after successfull installation:

sudo apt-get update
sudo apt-get upgrade -y

WCS deployment

JDK installation

Any of JDK versions supported may be installed from repositories or manually depending on JDK packages availability in distro used. For example, JDK 8 is available in repositories for Ubuntu 18.04:

sudo apt-get install -y openjdk-8-jdk

and JDK 14 should be installed manually

# Download JDK package
sudo rm -rf jdk*
curl -s https://download.java.net/java/GA/jdk14.0.1/664493ef4a6946b186ff29eb326336a2/7/GPL/openjdk-14.0.1_linux-x64_bin.tar.gz | tar -zx
[ ! -d jdk-14.0.1/bin ] && exit 1

# Prepare installation folder
sudo mkdir -p /usr/java
[ -d /usr/java/jdk-14.0.1 ] && sudo rm -rf /usr/java/jdk-14.0.1

# Move JDK files to installation folder
sudo mv -f jdk-14.0.1 /usr/java
[ ! -d /usr/java/jdk-14.0.1/bin ] && exit 1

# Make /usr/java/default symlink to installation folder for convenience
sudo rm -f /usr/java/default
sudo ln -sf /usr/java/jdk-14.0.1 /usr/java/default

# Make the necessary symlinks
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk-14.0.1/bin/java" 1
sudo update-alternatives --install "/usr/bin/jstack" "jstack" "/usr/java/jdk-14.0.1/bin/jstack" 1
sudo update-alternatives --install "/usr/bin/jcmd" "jcmd" "/usr/java/jdk-14.0.1/bin/jcmd" 1
sudo update-alternatives --install "/usr/bin/jmap" "jmap" "/usr/java/jdk-14.0.1/bin/jmap" 1
sudo update-alternatives --set "java" "/usr/java/jdk-14.0.1/bin/java"
sudo update-alternatives --set "jstack" "/usr/java/jdk-14.0.1/bin/jstack"
sudo update-alternatives --set "jcmd" "/usr/java/jdk-14.0.1/bin/jcmd"
sudo update-alternatives --set "jmap" "/usr/java/jdk-14.0.1/bin/jmap"

WCS installation

Use the following command to install latest WCS build:

wget https://flashphoner.com/download-wcs5.2-server.tar.gz -O- | tar -zx
cd FlashphonerWebCallServer-*
sudo ./install.sh

Activate WCS license (you can get a trial here)

cd /usr/local/FlashphonerWebCallServer/bin
sudo ./activation.sh

WCS launching

Unfortunately, systemd is not shipped with Ubuntu for WSL 2. So WCS can be launched as follows

cd /usr/local/FlashphonerWebCallServer/bin
sudo ./webcallserver set-permissions
sudo ./webcallserver start

Check if WCS is successfully started with command

sudo ./webcallserver status

Testing

1. Open WCS web interface in local browser by the link http://localhost:8081/admin/ and enter user name demo, password demo

2. Choose Two Way Streaming example in left menu

3. Publish and play a stream in the example

Known issues

1. Only one WSL instance can run simultaneously

You can install a multiple WSL instances using some tricks, but they cannot be launched simultaneously.

2. WSL instance IP address is changing on every PC reboot

Symptoms

When WCS is started after PC reboot, streeam cannot be published with the following error

No free ports available

Solution

After PC reboot, start WCS with IP addresses configuration

cd /usr/local/FlashphonerWebCallServer/bin
sudo ./webcallserver set-ip
sudo ./webcallserver start