Setup OBS in Ubuntu for 24/7 YouTube Live StreamingSetup OBS in Ubuntu for 24/7 YouTube Live Streaming
Setup OBS in Ubuntu for 24/7 YouTube Live Streaming
Date: Nov 21, 2020
This is an accompanying note for YouTube video at 🌐 You can open the video side-by-side along with this note when you are doing the setup. The setup can take around 10 to 15 minutes.

Before starting, make sure you know how to login to your server using ssh. Once you're logged in, you can proceed with the script. While the script is created to automate the whole setup flow, it's not tested for unattended installation. You should monitor the script while it's running so you can see if there's any error.
Copy and paste this command in your server (Ubuntu 20) using terminal:
curl -s | sudo sh
Expand this section to see the explanation of above command.
Above command will download the setup script at Comments in the script have been removed to make it more compact. And this is the explanation of the setup script:
## Ubuntu 20 (fresh install) ##

# Update repo
$ sudo apt update

# Install ubuntu desktop using tasksel
$ sudo apt install tasksel -y
$ sudo tasksel install ubuntu-desktop

# Install screen to run obs in background
$ sudo apt install screen -y

# Install virtualgl and turbovnc (based on steps from
$ wget -O virtualgl_2.6.3_amd64.deb
$ sudo dpkg -i virtualgl_*.deb
$ /opt/VirtualGL/bin/vglserver_config # (select default options)
$ wget -O turbovnc_2.2.5_amd64.deb
$ sudo dpkg -i turbovnc_*.deb

# Start turbovnc server
$ /opt/TurboVNC/bin/vncserver

# Install obs (using obs from snap doesn't seem to work)
$ sudo apt-get install libxkbcommon0 libxrandr2 libqt5core5a # obs dependencies
$ sudo apt-get install software-properties-common -y
$ sudo apt-add-repository ppa:obsproject/obs-studio
$ sudo apt update -y
$ sudo apt-get install obs-studio

# Install ffmpeg, vlc, chromium
$ sudo apt install ffmpeg vlc

# Adjust vnc config file to support custom base port
$ sed 's/$vncPort = 5900 + $displayNumber;/$vncPort = 5900 + $displayNumber;\nif(defined $ENV{'BASE_PORT'}) {\n  $vncPort = $ENV{'BASE_PORT'} + $displayNumber;\n}/' /opt/TurboVNC/bin/vncserver

# Start vnc server and obs in background
$ BASE_PORT=6700 /opt/TurboVNC/bin/vncserver
$ /usr/bin/screen -dmS obs /usr/bin/sh -c "DISPLAY=:1 /usr/bin/obs --studio-mode"

# Update cron so vnc and OBS can automatically run if the machine reboots.
$ crontab -l > ~/crontab.backup.txt
$ echo '@reboot BASE_PORT=6700 /opt/TurboVNC/bin/vncserver' > /tmp/obs-crontab.txt
$ echo '@reboot /usr/bin/screen -dmS obs /usr/bin/sh -c "DISPLAY=:1 /usr/bin/obs --studio-mode"' >> /tmp/obs-crontab.txt
$ crontab /tmp/obs-crontab.txt

# All done.
# OBS is now started and you can login to your server using vnc client.
That's it!
Now you can connect to your server using vnc client. You can download and install free vnc client like RealVNC (
If you need any help, send me an email at or connect with me via twitter.

🍬 Bonus

  • By default, OBS in Ubuntu doesn't include browser source. To install OBS browser source, run this command:
    • wget && \
      tar zxvf linuxbrowser0.6.1-obs23.0.2-64bit.tgz && \
      mkdir -p ~/.config/obs-studio/plugins && \
      mv obs-linuxbrowser/ ~/.config/obs-studio/plugins
  • If you need to change your vnc password, run this command: vncpasswd
Was this helpful?

Loading Comments...