Skip to content

Instantly share code, notes, and snippets.

@applecargo
Forked from krithin/raspberry-pi-install.md
Last active August 13, 2020 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save applecargo/ee8b3a8fc1e5b428d39b7c9598e4936e to your computer and use it in GitHub Desktop.
Save applecargo/ee8b3a8fc1e5b428d39b7c9598e4936e to your computer and use it in GitHub Desktop.
Jitsi Meet Server and Videobridge Installation on Raspberry Pi 4 with Ubuntu Server 20.04

Jitsi Meet install on a Raspberry Pi 4 with Ubuntu Server 20.04

This guide helps you host your own Jitsi server on a Raspberry Pi 4B. It is adapted from Jitsi's quick install guide and the Jitsi on ARM guide written by crouchingtigerhiddenadam. The biggest difference is this is designed to work with a Pi running Ubuntu Server 20.04 instead of Raspbian.

I did this because I'd rather set up Jitsi Meet on a Raspberry Pi I already own than add a dedicated VPS (and pay AWS's bandwidth costs) just for that. I used Ubuntu 20.04 because I'm more familiar with Ubuntu than with Raspbian, and using an arm64 OS makes the setup easier than on armhf. I also tried to use distribution packages instead of manually downloading individual deb files throughout.

Prerequisites

This guide assumes you already have a DNS name set up with an A record pointing to the public IP address of your Raspberry Pi.

Get Ubuntu Server 20.04 for Raspberry Pi

You can get this from https://ubuntu.com/download/raspberry-pi - I used the 64-bit image for Raspberry Pi 4. The default username and password on that are both "ubuntu"; it will prompt you to set a new password on first login.

You'll want to set that up the same way you would any other distribution for a Pi, and set yourself up for SSH access if you don't have a conveniently-placed keyboard connected to your Pi. If you're not familiar with how to get started writing that disk image to a microSD card there's a tutorial you can follow at https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#1-overview for this step.

Install the Jitsi packages

Generally speaking this means you'll need to follow the instructions at https://github.com/jitsi/jitsi-meet/blob/master/doc/quick-install.md, but stop before the Let's Encrypt certificate step.

In slightly more detail:

Set up your Fully-Qualified Domain Name

I assume you already have an FQDN set up in DNS that you want to use for this Jitsi install - suppose that's jitsi.example.com. First, change the hostname on the machine to match that:

sudo hostnamectl set-hostname jitsi.example.com

Then use vim or your favorite editor to put the same FQDN in the /etc/hosts file, associating it with the loopback address. This means you'll edit the first line of that file so it looks like:

127.0.0.1 localhost jitsi.example.com

After modifying the hostname and hosts files you'll want to restart your Pi so that the changes take effect: sudo shutdown -r now.

Add the Jitsi package repository

echo 'deb https://download.jitsi.org stable/' | sudo tee /etc/apt/sources.list.d/jitsi-stable.list
wget -qO -  https://download.jitsi.org/jitsi-key.gpg.key | sudo apt-key add -

Open ports in your firewall

Open 80/TCP, 443/TCP and 10000/UDP on your firewall, making sure those ports are forwarded to your Pi if it's behind a NAT.

Install the Jitsi Meet packages

# Ensure support is available for apt repositories served via HTTPS
sudo apt install apt-transport-https

# Retrieve the latest package versions across all repositories
sudo apt update

# Perform jitsi-meet installation
sudo apt install jitsi-meet

The installer will ask you for the hostname of your Jitsi Meet instance; set that to the same FQDN you entered earlier. Then it'll ask about an SSL certificate; pick "Generate a new self-signed certificate". We'll set up a real SSL cert with Let's Encrypt in the next step.

Generate an SSL certificate with Let's Encrypt

Here our instructions diverge from the Jitsi quick-install guide. The script metioned there uses certbot-auto, which is not supported on Ubuntu 20.04, so we're going to modify the script a little to make it work. We still want to use that script instead of calling certbot ourselves because the script also sets up a post-renewal hook for the turnserver.

First, install certbot from the Ubuntu repositories:

sudo apt install certbot

Then update Jitsi's letencrypt cert install script to make it use our locally installed certbot:

# Backup the cert install script
sudo cp /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh ~/install-letsencypt-cert.sh.bak

# Edit the install script
sudo vim /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh

# Edit the file by hand in vim:
# 1. remove the call to install certbot-auto, and all references to $CRON_FILE (lines 28-38, 78, 99 and 103-104 in my version)
# 2. replace all the remaining calls to './certbot-auto' to 'certbot' - there should be three of them.

Don't worry if you mess this up; that's why we created a backup! Once you're done, you can check that your diff looks like mine: https://gist.github.com/krithin/ff346a5f4d8a442235fbf96900ed4d36

Once done with the edits, run the script and have it generate certs:

sudo /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh

At this point you should see the landing page load correctly at https://jitsi.example.com! Yay! Unfortunately we're not done yet, because as you'll see it doesn't actually work if you try to connect multiple clients to a jitsi meeting; we'll fix that in the next step.

Install SCTP from source

This section is cribbed off jitsi-meet issue 6449.

Install openjdk-8 and build requirements

sudo apt install openjdk-8-jdk build-essential libtool maven

Stop services

sudo systemctl stop prosody jitsi-videobridge2 jicofo

Choose jdk to use (e.g. java-8-openjdk-arm64)

sudo update-alternatives --config java
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-arm64/

Recompile jniwrapper-native-1.0-SNAPSHOT

git clone https://github.com/sctplab/usrsctp.git
git clone https://github.com/jitsi/jitsi-sctp
mv ./usrsctp ./jitsi-sctp/usrsctp/
cd ./jitsi-sctp
mvn package -DbuildSctp -DbuildNativeWrapper -DdeployNewJnilib -DskipTests

Copy libjnisctp.so

cp ./jniwrapper/native/target/libjnisctp-linux-aarch64.so \
 ./jniwrapper/native/src/main/resources/lib/linux/libjnisctp.so

Re-package and Copy jniwrapper-native-1.0-SNAPSHOT.jar into Jitsi VideoBridge2

When running mvn package ensure all unit tests are successful. You will see some warnings about "Using platform encoding", but that's fine because we're building on the platform that we intend to run this on anyway.

sudo mvn package
sudo cp ./jniwrapper/native/target/jniwrapper-native-1.0-SNAPSHOT.jar \
 /usr/share/jitsi-videobridge/lib/jniwrapper-native-1.0-SNAPSHOT.jar

Restart the services

sudo systemctl start prosody jitsi-videobridge2 jicofo

Check if it worked!

systemctl status jitsi-videobridge2

Fire up your web browser, start a jitsi meeting, join it from another tab or another device, and check the jitsi logs at sudo less /var/log/jitsi/jvb.log if something is amiss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment