How to install Owncast v0.0.12 on Ubunto 20.0.4


Install curl

root@server:~# apt-get install curl

Remove Apache

root@server:~# apt-get purge apache2 apache2-utils apache2-bin apache2.2-common

Add a new user

root@server:~# adduser owncast

Switch the user

root@server:~# su owncast

Change directory

owncast@server:/root$ cd

Download Owncast

owncast@server:~$ curl -s https://owncast.online/install.sh | bash

Change directory

owncast@server:~$ cd owncast/

Run Owncast

owncast@server:~/owncast$ ./owncast

Output

Owncast Installer v0.0.12

Created directory  [✓]
Downloaded Owncast v0.0.12 for linux  [✓]
Downloaded ffmpeg because it was not found on your system [✓]

Success! Run owncast by changing to the owncast directory and run ./owncast.
The default port is 8080 and the default streaming key is abc123.
Visit https://owncast.online/docs/configuration/ to learn how to configure your new Owncast server.

owncast@server:~$ cd owncast/
owncast@server:~/owncast$ ./owncast
INFO[2022-07-12T20:21:24Z] Owncast v0.0.12-linux-64bit (2d44f8603577bf1eb125447b3894462fa1310960)
INFO[2022-07-12T20:21:24Z] Video transcoder started using x264 with 1 stream variants.
INFO[2022-07-12T20:21:24Z] RTMP is accepting inbound streams on port 1935.
INFO[2022-07-12T20:21:24Z] Web server is listening on IP 0.0.0.0 port 8080.
INFO[2022-07-12T20:21:24Z] The web admin interface is available at /admin.

Exit as user

owncast@server:~/owncast$ exit

Install a couple of packages

root@server:~# apt install nginx python3 python3-venv libaugeas0 ufw -y

Setup certbot

root@server:~# python3 -m venv /opt/certbot/
root@server:~# /opt/certbot/bin/pip install --upgrade pip
root@server:~# /opt/certbot/bin/pip install certbot certbot-nginx
root@server:~# ln -s /opt/certbot/bin/certbot /usr/bin/certbot

Create a certificate

root@server:~# certbot --nginx

Remove the default configuration

root@server:~# rm /etc/nginx/sites-enabled/default

Add a new configuration

root@server:~# vi /etc/nginx/sites-enabled/owncast.irlstream.de

With the following content

server {
    listen 80;
    listen [::]:80;
    access_log  /var/log/nginx/owncast.irlstream.de.access.log;
    error_log   /var/log/nginx/owncast.irlstream.de.error.log;
    server_name owncast.irlstream.de;
    # enforce https
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    server_name owncast.irlstream.de;

    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_http_version 1.1;
        proxy_pass http://127.0.0.1:8080;
    }

        ssl_certificate /etc/letsencrypt/live/owncast.irlstream.de/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/owncast.irlstream.de/privkey.pem;

}

Nginx test

root@server:~# nginx -t

Nginx restart

root@server:~# service nginx restart

Setup the firewall

root@server:~# ufw allow 22/any comment 'SSH'
root@server:~# ufw allow 80/any comment 'HTTP'
root@server:~# ufw allow 443/any comment 'HTTPS'
root@server:~# ufw allow 1935/any comment 'RTMP'
root@server:~# ufw enable

Change directory

root@server:~# cd /etc/systemd/system
root@server:/etc/systemd/system# vi owncast.service

Add a new configuration

[Unit]
Description=Owncast Service
After=network.target

[Service]
Type=forking
WorkingDirectory=/home/owncast/owncast
User=owncast
Group=owncast
ExecStart=/home/owncast/owncast/owncast
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Enable autostart

systemctl enable owncast.service
systemctl start owncast.service

Login to admin

URL: https://owncast.irlstream.de/admin/
Username: admin
Password: abc123 <-- Needs to be changed

Stream to Owncast with OBS

URL: rtmp://owncast.irlstream.de
Key: abc123 <-- Needs to be changed

Leave a Reply

Your email address will not be published. Required fields are marked *