sodcalculator

10 Tech How-To

Install OBS Studio on Oracle Cloud Ubuntu Server (No Desktop)

Guide 10-18377 · Updated · Step by step

This guide walks you through installing OBS Studio on an Oracle Cloud Infrastructure (OCI) Ubuntu server that has no graphical desktop environment. You’ll end up with a working OBS installation that can be used for headless streaming or recording, controlled remotely via SSH and a virtual display. Before starting, ensure you have SSH access to your Oracle Cloud instance and that it runs a supported Ubuntu version (20.04 or 22.04 LTS).

What You’ll Need

  • An Oracle Cloud Always Free or paid Ubuntu instance (e.g., VM.Standard.E2.1.Micro) with SSH access.
  • A terminal client (PuTTY on Windows, Terminal on macOS/Linux).
  • Basic comfort with the command line.
  • sudo privileges on the instance.

Step-by-Step

  1. Connect to your instance via SSH: ssh ubuntu@<your-public-ip> (replace with your actual IP). If you’re using a key pair, specify it with -i /path/to/key.
  2. Update the system to ensure all packages are current:
    sudo apt update && sudo apt upgrade -y
  3. Install required dependencies for OBS and virtual display support:
    sudo apt install -y ffmpeg xvfb x11vnc build-essential cmake libx11-dev libxcomposite-dev libxdamage-dev libxrandr-dev libxtst-dev libxinerama-dev libxss-dev libgl1-mesa-dev libgles2-mesa-dev libwayland-dev libpulse-dev libpipewire-0.3-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev libx264-dev libcurl4-openssl-dev libmbedtls-dev libasound2-dev libjack-jackd2-dev libdbus-1-dev libfontconfig1-dev libfreetype6-dev libpci-dev libv4l-dev libxcb-shm0-dev libxcb-xfixes0-dev libxcb-randr0-dev libxcb-shape0-dev zlib1g-dev libqt5svg5-dev libqt5x11extras5-dev qttools5-dev qttools5-dev-tools
  4. Install OBS Studio from the official PPA (simplest method):
    sudo add-apt-repository ppa:obsproject/obs-studio -y
    sudo apt update
    sudo apt install -y obs-studio
  5. Verify the installation by checking the version:
    obs --version (should output something like OBS 30.x)
  6. Set up a virtual display using Xvfb. OBS needs a display server, even if headless. Create a systemd service to run Xvfb on display :99:
    sudo tee /etc/systemd/system/xvfb.service <<EOF
    [Unit]
    Description=Xvfb Virtual Display
    After=network.target
    [Service]
    ExecStart=/usr/bin/Xvfb :99 -screen 0 1920x1080x24
    Restart=always
    [Install]
    WantedBy=multi-user.target
    EOF
    Then enable and start it:
    sudo systemctl enable xvfb && sudo systemctl start xvfb
  7. Set the DISPLAY environment variable for OBS sessions. Add to your shell profile:
    echo "export DISPLAY=:99" >> ~/.bashrc
    source ~/.bashrc
  8. Test OBS headless by running it briefly to ensure it starts without errors:
    obs --headless --disable-shutdown-check (press Ctrl+C to stop after a few seconds). If it starts without error, you’re good.
  9. Configure OBS for remote control (optional but recommended). Enable the WebSocket server in OBS settings. Since you can’t use the GUI, edit the config file directly:
    mkdir -p ~/.config/obs-studio
    nano ~/.config/obs-studio/global.ini
    Add these lines under [General]:
    EnableWebSocket=true
    WebSocketPort=4455
    WebSocketPassword=your_strong_password
    Save and exit.
  10. Set up a virtual camera or streaming output (optional). For streaming, you can use OBS’s built-in RTMP output. For recording, you can use the command line to start a recording:
    obs --headless --startrecording --scene "Scene" (after creating a scene via a config file or using the API).
  11. Test a simple recording to confirm everything works. Create a basic scene and source via the WebSocket API using a script (e.g., with Python and obs-websocket-py), or use the command line with a pre-made scene collection. For a quick test, you can use the obs-cmd tool if installed.

Common Mistakes

  • Forgetting to set DISPLAY: OBS will fail with “cannot open display” if DISPLAY isn’t set to the Xvfb display.
  • Using the wrong package source: The default Ubuntu repos may have an older OBS. Always use the official PPA.
  • Skipping dependencies: Missing libraries cause compilation errors if you build from source, but the PPA handles them automatically. However, if you build manually, you’ll need all dependencies.
  • Not enabling the WebSocket server: Without it, you cannot control OBS headlessly, which defeats the purpose.
  • Using a display resolution too high for the server’s memory: The Always Free tier has 1GB RAM; a 1080p virtual display is fine, but 4K might cause memory issues.

Tips

  • Use a lightweight desktop alternative if you need occasional GUI access: install Xfce4 and VNC (e.g., TightVNC) to manage OBS visually without a full desktop environment.
  • Automate OBS startup with systemd: create a service that runs OBS in headless mode with your desired flags, so it starts on boot.
  • Use the WebSocket API to control OBS remotely via scripts. This is the most reliable way to manage scenes, sources, and recording/streaming without a GUI.
  • Monitor resource usage with htop to ensure OBS isn’t overloading your small instance.
  • Set up a virtual audio device if you need to capture audio. Use pulseaudio with a null sink: pactl load-module module-null-sink.

Troubleshooting

  • OBS won’t start: “cannot open display” – Ensure Xvfb is running (sudo systemctl status xvfb) and DISPLAY is set correctly.
  • Missing libraries after PPA install – Run sudo apt --fix-broken install to resolve dependency issues.
  • WebSocket connection refused – Check that OBS is running with the WebSocket enabled (look for “WebSocket server started” in logs). Also verify the port is open in your Oracle Cloud security list (add an ingress rule for port 4455 if needed).
  • OBS crashes when starting recording – Check the logs at ~/.config/obs-studio/logs/ for errors. Often it’s due to missing audio or video sources. Create a minimal scene with a test source (e.g., a color source) via the API.
  • High CPU usage – The Always Free tier has limited CPU. Reduce the output resolution or frame rate in OBS settings (e.g., 720p30).
  • Cannot connect via VNC – Ensure x11vnc is running and the port is open. Test locally with sudo x11vnc -display :99 -forever.

Frequently Asked Questions

Can I use OBS on Oracle Cloud’s free tier?

Yes, the Always Free tier (1 GB RAM, 1 OCPU) can run OBS for light streaming or recording, but expect limited performance. Stick to 720p or lower and avoid heavy sources.

Do I need a desktop environment to use OBS?

No, you can run OBS in headless mode with a virtual display (Xvfb). You control it via the WebSocket API or command line.

How do I stream to Twitch or YouTube from OBS headless?

Configure a streaming service in OBS (via the WebSocket API or config file) with your stream key, then start streaming with obs --headless --startstreaming.

Can I record video without a display?

Yes, with Xvfb providing a virtual display, OBS can record any source (e.g., a window or a test pattern) to a file.

Is it better to build OBS from source instead of using the PPA?

For most users, the PPA is easier and updated regularly. Building from source gives you more control but requires more time and dependencies.

How do I update OBS later?

Simply run sudo apt update && sudo apt upgrade to get the latest version from the PPA.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →