Get Started using Livepeer Cloud and Owncast

A comprehensive guide for installing and configuring Owncast, a live streaming server, on a Linux-based system. It provides a thorough walk-through for individuals seeking to deploy their own live streaming server, catering to both novices and experienced users.

The key topics discussed in this guide:

  • step-by-step instructions for setting up Apache
  • obtaining Lets Encrypt TLS certificates
  • Owncast installation via Linux binaries or Docker.
  • Configuring Owncast to Stream Relaying through the Livepeer.cloud Service powered by the Livepeer Network.

Prerequisites

This guide assumes you are familiar with Linux and have an understanding of basic Linux commands, installing software and configuring network-based services like DNS, firewalls, etc..

  • Server with public IP
  • A Domain name (owncast.example.com)
  • Email of the DNS owner for Lets Encrypt
  • linux based OS
  • Ubuntu 20.04 and 22.04 were tested as part of this guide
  • OTHER Linux OS should find the equivalent steps needed based on this Ubuntu based guide
  • docker is required if you want to use docker
  • Optional docker marketplace app via Vultr (or alternative)
    • (The vultr link above is a referal link. You will receive $100 in credits)

Required ports

Enssure the following ports are accessible in your firewall/router

  • 80 (HTTP)
  • 443 (HTTPS)
  • 1935 (RTMP)

Step 1: Linux setup

Make sure your server is up-to-date, then install the prerequisite packages:

apt update
apt upgrade -y
apt install unzip ffmpeg

Verify ffmpeg version (must be 4.1.5 or higher)

ffmpeg -version

Step 2: Install Apache

apt install apache2 certbot python3-certbot-apache

Create an Apache virtual host for Owncast:

nano /etc/apache2/sites-available/owncast.conf

Insert the following configuration:

<VirtualHost *:80>
ServerName owncast.example.com
ServerAdmin [email protected]

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable the virtual host, reload Apache to apply the new configuration, and run Certbot to get a TLS certificate:

a2ensite owncast
systemctl reload apache2
certbot --apache

Edit the new Owncast TLS virtual host:

nano /etc/apache2/sites-available/owncast-le-ssl.conf

Insert the following additional configuration after this line:

CustomLog ${APACHE_LOG_DIR}/access.log combined

        # Proxy traffic to/from Owncast.
        ProxyRequests Off
        ProxyPreserveHost On
        AllowEncodedSlashes NoDecode

        <Proxy *>
        Order deny,allow
        Allow from all
        </Proxy>

        ProxyPass / http://localhost:8080/
        ProxyPassReverse / http://localhost:8080/

        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Port "443"

        # Ensure websocket connections are also proxied.
        RewriteEngine On
        RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]
        RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
        RewriteRule .* ws://127.0.0.1:8080%{REQUEST_URI} [P,QSA,L]

The configuration file should like this once you made the modifications:

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName owncast.example.com
        ServerAdmin [email protected]

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # Proxy traffic to/from Owncast.
        ProxyRequests Off
        ProxyPreserveHost On
        AllowEncodedSlashes NoDecode

        <Proxy *>
        Order deny,allow
        Allow from all
        </Proxy>

        ProxyPass / http://localhost:8080/
        ProxyPassReverse / http://localhost:8080/

        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Port "443"

        # Ensure websocket connections are also proxied.
        RewriteEngine On
        RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]
        RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
        RewriteRule .* ws://127.0.0.1:8080%{REQUEST_URI} [P,QSA,L]

        SSLCertificateFile /etc/letsencrypt/live/owncast.example.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/owncast.example.com/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

Enable the necessary Apache modules, then restart Apache to load them and apply the new configuration:

a2enmod proxy_http proxy_wstunnel headers
systemctl restart apache2

Step 3: Chose Owncast install

Chose your installation path for Owncast

a. Install via linux binaries

b. Install via docker

If you choose docker skip step 3a and jump to Step 3b

Step 3a: Install Owncast binary

Create Owncast directory:

mkdir /opt/owncast
cd /opt/owncast

Download and unzip the Stream Relay Enabled Owncast binary:

wget https://github.com/mikezupper/owncast/releases/download/v0.1.3/owncast-0.1.3-linux-64bit.zip
unzip owncast-0.1.3-linux-64bit.zip
rm owncast*.zip

Setup a linux service:

sudo nano /etc/systemd/system/owncast.service

Insert the following configuration:

[Unit]
Description=Owncast

[Service]
Type=simple
RestartSec=5
WorkingDirectory=/opt/owncast/
ExecStart=/opt/owncast/owncast
Restart=on-failure

[Install]
WantedBy=default.target

Reload systemd, then enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable --now owncast

To start and stop the service use the following commands

sudo systemctl stop owncast
sudo systemctl start owncast

How to view the logs, useful for troubleshooting

sudo journalctl -u owncast -n 500 -f

You should see similar output:

INFO[2024-03-29T22:55:41Z] Owncast vdev-docker (20240329)
INFO[2024-03-29T22:55:41Z] Stream relay configuration is disabled
INFO[2024-03-29T22:55:41Z] Web server is listening on port 8080.
INFO[2024-03-29T22:55:41Z] Configure this server by visiting /admin.

Step 3b: Install Owncast using docker

If you don't already have docker installed, follow the docker installation guide

or you can run the following script to install docker automatically

curl https://releases.rancher.com/install-docker/20.10.sh | sh

Create the Owncast data directory

mkdir -p /opt/owncast/data

Change permissions for /opt/owncast/data

chmod 777 /opt/owncast/data

Pull the Stream Relay enabled Owncast docker image

docker pull tztcloud/owncast:v0.1.3

Run the Owncast Container

docker run -d --name owncast --restart unless-stopped -v /opt/owncast/data:/app/data -p 8080:8080 -p 1935:1935 -it tztcloud/owncast:v0.1.3

Confirm the docker container is running

docker ps

To view docker logs

docker logs -f owncast

You should see similar output:

INFO[2024-03-29T22:55:41Z] Owncast vdev-docker (20240329)
INFO[2024-03-29T22:55:41Z] Stream relay configuration is disabled
INFO[2024-03-29T22:55:41Z] Web server is listening on port 8080.
INFO[2024-03-29T22:55:41Z] Configure this server by visiting /admin.

To stop and start you docker container use the following commands

docker stop owncast
docker start owncast

Step 4: Configure Owncast

Configuration is done through the Owncast administration page located at https://owncast.example.com/admin. The login username is admin and the password is your stream key, the default being abc123.

It’s highly encouraged to change both your stream key and your admin passwords immediately after installation by visiting https://owncast.example.com/admin/config/server/

For the default install instructions reivew Owncasts offical doc page: https://owncast.online/docs/configuration/

Step 5: Configure the Stream Relay

In order to take advantage of the Livepeer Cloud "Free to Use" service, you need to configure the Stream Relay from the https://owncast.example.com/admin/config/server/ page.

Select the "Stream Relay" tab.

  • Toggle "Stream Relay Configuration" to ON

Livepeer Cloud is a regional service. Select an RTMP Url from the region closest to you.

Here is the list of available servers:

Once all the changes are made, Click Save

Step 6: Broadcast to Owncast

In general Owncast is compatible with any software that uses RTMP to broadcast to a remote server. RTMP is what all the major live streaming services use, so if you’re currently using one of those it’s likely that you can point your existing software at your Owncast instance instead.

Pointing your software to Owncast

Most broadcasting software will have a way to specify a “custom” location as a RTMP endpoint. In this case you would specify rtmp://owncast.example.com/live as the RTMP destination, specifying your streaming key where it asks for it. The default stream key is abc123 but you should change this immediately after setting up Owncast.

If your software doesn’t have a place to specify a streaming key you can simply append it to your RTMP location, for example: rtmp://owncast.example.com/live/abc123.

For more information about configuring your broadcasting software view the Owncast Broadcast Software docs https://owncast.online/docs/broadcasting/

Using OBS to send a stream to Owncast

  1. Install OBS and get it working with your local setup.

  2. Open OBS Settings and go to “Stream”.

  3. Select “Custom…” as the service.

  4. Enter the URL of the server running your streaming service in the format of rtmp://owncast.example.com/live.

  5. Enter your “Stream Key” that matches your key file.

  6. Start the server.

  7. Press “Start Streaming” (OBS).

Self Hosted Stream Relay Server

Click to learn more about self hosting you own Livepeer Gateway for a Stream Relay Server. https://www.livepeer.cloud/self-hosted-livepeer-gateway