Skip to content

Instantly share code, notes, and snippets.

@dimaskiddo
Last active November 28, 2022 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save dimaskiddo/da6dfe184ce54db7293f128cf8eb7039 to your computer and use it in GitHub Desktop.
Save dimaskiddo/da6dfe184ce54db7293f128cf8eb7039 to your computer and use it in GitHub Desktop.
Jitsi Jibri Automatic Installer
#!/bin/bash -e
# Current Directory
CURRENT_DIR=$(pwd)
# Header Function
function printhead() {
clear
echo "--------------------------------------------------"
echo "Jitsi Jibri Automatic Installer"
echo "Email: dimas.restu@student.upi.edu"
echo "--------------------------------------------------"
echo ""
}
# Check Privileges
if [[ $UID -ne 0 ]]; then
echo "Administrator Privilege Needed. Please Run This Program As An Administrator/Root User!"
exit 1
fi
# Check Platform
if [[ $(uname -i) != "x86_64" ]]; then
echo "Platform Not Supported. Please Run This Program in 64-bit Platform!"
exit 1
fi
# Change Working Directory
printhead
echo "--------------------------------------------------"
echo "Change Working Directory"
cd $CURRENT_DIR
echo "--------------------------------------------------"
sleep 2
# Install Dependencies and Tools
printhead
echo "--------------------------------------------------"
echo "Install Dependencies and Tools"
apt-get update && apt-get install -y apt-transport-https apt-utils ca-certificates gnupg \
&& apt-get install -y jq procps curl vim iputils-ping net-tools htop iftop iperf3
echo "--------------------------------------------------"
sleep 2
# Install OpenJDK 8 JRE
printhead
echo "--------------------------------------------------"
echo "Install OpenJDK 8 JRE"
apt-get update && apt-get install -y openjdk-8-jre-headless
update-java-alternatives --jre-headless --set java-1.8.0-openjdk-amd64
echo "--------------------------------------------------"
sleep 2
# Install Linux Image Extra Virtual
printhead
echo "--------------------------------------------------"
echo "Install Linux Image Extra Virtual"
apt-get update && apt-get install -y linux-image-extra-virtual
echo "--------------------------------------------------"
sleep 2
# Load Sound Alsa Loop Kernel Module
printhead
echo "--------------------------------------------------"
echo "Load Sound Alsa Loop Kernel Module"
modprobe snd-aloop
MODULES_COUNT=`grep snd-aloop /etc/modules | wc -l`
if [[ $MODULES_COUNT -eq 0 ]]; then
{ \
echo ""; \
echo "snd-aloop";
} >> /etc/modules
fi
LSMOD_COUNT=`lsmod | grep snd_aloop | wc -l`
if [[ $LSMOD_COUNT -lt 1 ]]; then
echo "Failed to Load Sound Alsa Loop Kernel Module"
echo ""
echo "Please try to reboot your system to make sure it's using the latest kernel"
echo "and you can try to run the installation again"
exit 1
fi
echo "--------------------------------------------------"
sleep 2
# Installing Google Chrome Repository
printhead
echo "--------------------------------------------------"
echo "Installing Google Chrome Respository"
wget -qO - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
echo "--------------------------------------------------"
sleep 2
# Installing Google Chrome
printhead
echo "--------------------------------------------------"
echo "Installing Google Chrome"
apt-get update && apt-get install -y google-chrome-stable
if [[ ! -d /etc/opt/chrome/policies/managed ]]; then
mkdir -p /etc/opt/chrome/policies/managed
fi
if [[ -f /etc/opt/chrome/policies/managed/managed_policies.json ]]; then
CHROME_SECURITY_POLICIES=`grep '"CommandLineFlagSecurityWarningsEnabled": false' /etc/opt/chrome/policies/managed/managed_policies.json | wc -l`
if [[ $CHROME_SECURITY_POLICIES -eq 0 ]]; then
echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' >> /etc/opt/chrome/policies/managed/managed_policies.json
fi
else
echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' >> /etc/opt/chrome/policies/managed/managed_policies.json
fi
echo "--------------------------------------------------"
sleep 2
# Installing Google Chrome Driver
printhead
echo "--------------------------------------------------"
echo "Installing Google Chrome Driver"
apt-get update && apt-get install -y unzip
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
wget -qO /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip
echo A | unzip /tmp/chromedriver.zip -d /usr/local/bin/
rm -f /tmp/chromedriver.zip
echo "--------------------------------------------------"
sleep 2
# Installing Jitsi Repository
printhead
echo "--------------------------------------------------"
echo "Installing Jitsi Repository"
wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | apt-key add -
echo "deb https://download.jitsi.org stable/" > /etc/apt/sources.list.d/jitsi-stable.list
echo "--------------------------------------------------"
sleep 2
# Installing Jibri
printhead
echo "--------------------------------------------------"
echo "Installing Jibri"
apt-get update && apt-get install -y jibri
echo "--------------------------------------------------"
sleep 2
# Creating Jibri Log Directory at /var/log/jitsi/jibri
printhead
echo "--------------------------------------------------"
echo "Creating Jibri Log Directory at /var/log/jitsi/jibri"
mkdir -p /var/log/jitsi/jibri
chown jibri:jitsi /var/log/jitsi/jibri
echo "--------------------------------------------------"
sleep 2
# Creating Jibri Recording Directory at /srv/recordings
printhead
echo "--------------------------------------------------"
echo "Creating Jibri Recording Directory at /srv/recordings"
mkdir -p /srv/recordings
chown jibri:jitsi /srv/recordings
echo "--------------------------------------------------"
sleep 2
# Enabling and Restart Jibri-XORG Service
printhead
echo "--------------------------------------------------"
echo "Enabling and Stop Jibri-XORG Service"
systemctl enable jibri-xorg
systemctl restart jibri-xorg
echo "--------------------------------------------------"
sleep 2
# Enabling and Stop Jibri Service
printhead
echo "--------------------------------------------------"
echo "Enabling and Stop Jibri Service"
systemctl enable jibri
systemctl stop jibri
echo "--------------------------------------------------"
sleep 2
# Cleaning-up
printhead
echo "--------------------------------------------------"
echo "Cleaning-up"
apt-get autoremove -y --purge
apt-get clean
echo "--------------------------------------------------"
sleep 2
# Completed
printhead
echo "--------------------------------------------------"
echo "Completed, please continue to configure Jitsi Jibri"
echo "--------------------------------------------------"
sleep 2
# Done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment