I made a very useful script, I may say so myself, of which I'm very sure that a small group of people will find it to be really useful as well. In case you plan to build your own live-stream server, you automatically become a member of this group. In which case, you should definitely read this article. I decided to share the script with the world, so I made it publically available at this repository on Github.
What does the script do exactly, you ask? Well, it builds a proper live-stream server for you, from scratch, on a server running on Ubuntu 22.04, fully automized. The only thing that is asked of you is to enter your email address, and a valid domain name that points to your server. It needs an email address for when it requests certificates from Letsencrypt for the domain you entered. The script takes care of everything else! The live-stream server will be fully configured and will work straight out-of-the-box. It supports Adaptive bitrate streaming, and it outputs HLS and/or DASH streams to the viewers. A web page with a video player showing the stream is included, and a stat page showing stream statistics as well. Both are secured with certificates running on HTTPS. And to bring it all together for you, I even wrote a guide that will help you to get familiar with the environment and get started with live-streaming. That sounds pretty awesome, doesn't it? (Yes, this is very awesome)
Before continuing, take a look at this video that I recorded, showing how to run the script, what the code looks like, and what things are important to know after it completed.

The script is able to handle almost the entire process of putting together a live-stream server. User interaction from your side is barely required. So, from this moment onwards, you won't have to manually set up a live-stream server, ever again! No more of your precious time will be spent on performing such a tedious task. By the way, did I mention already that this is a super awesome script? I'm not just saying that because I'm the one who created it and am proud of it. Or, well, perhaps I am a little bit, to be honest.
I should mention that I did not do it all myself. Somebody helped me out a couple of times, mostly to produce some of the code. She's always there for me in case I ever need help with coding. I'm talking of course about ChatGPT here.
So far, the script will run without errors on all the operating systems shown in the list below.
I know this is probably not the longest list you've ever seen in your life. Maybe, someday, I'll do some editing and start testing the script on other operating systems. It would be nice if this script would run on the most popular distro's. We'll see what happens..
Before running any foreign code on your server, you should always take a look at the script to see it doesn't contain any crap. Especially when it is a bash script! Here's a direct link the script, so taking a look at it first would be wise. Once you're ready to try it out, below is how you can run the script on your server. It doesn't matter to what folder you want to download the files from Github.
git clone https://github.com/ustoopia/auto-install-livestream-server-hls
cd auto-install-livestream-server-hls
sudo bash auto-installer.shInstalling everything doesn't take long at all, but the very last step in the script where it starts to generate a DH parameters file unfortunately takes a really long time. If you created such a file at an earlier moment, it doesn't make sense to create another one. Simply remove this last step from the script to save some time. I guess you know everything you need to know.
Hopefully, people who are searching the internet finding the best way to install a live-stream server will find their way to this page. And I'm hoping that everybody who used it will find it to be as useful as I find it to be. If this is the case, feel free to leave a comment to thank me.
To answer your questions; No, of course I don't mind if you leave a comment to thank me. And yes, if you want to show your appreciation in the form of a donation, I'm totally ok with that.
Plzzz how to scurise the live stream to use it only inmy website
Plzzzz help
contact me i can protect your streams allow only domain names you want
+212667400457
TG: @lamadya
Why don't you share it here? I'm curious...
Plzzz how to scurise the live stream to use it only in my website
Plzzzz help
Plzzzz help plzzzz i want to securise stream because to much website still my stream
I mentioned two url in the Youtube comments. And I also realized that you can use CORS for a great part to secure your livestream. Simply allow your domain to see the video, and your domain only.
thanks for all your work here, amazing easy to spin up on proxmox
just one thing I noticed on a virgin ubuntu lxc with no certbot ti complains of sudo: certbot: command not found
That's something I didn't come across during testing. The script does clearly install certbot using snap. Is this perhaps where things went wrong for you?
This is what is in the script, and should make it work in any cases:
# Install Snap core first so we can then install Certbot
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
# Create a link to certbot so we can use it later on
sudo ln -s /snap/bin/certbot /usr/bin/certbot
But since you pointed this out, I've added a couple of lines to the script that will check to see if certbot was installed or not.
# Check if certbot command exists (indicating successful installation)
if ! command -v certbot &> /dev/null; then
echo "Error: Certbot was not installed properly. Exiting."
exit 1
fi
I think snap wasnt available on the lxc thats where it craps out. Good catch and hope it reduces complaints or issues. I have forked your script and will look to add in the blockchain stuff, it will take some working through. I would love to then make a joint blog here in ustoopia to create a series of how people can decentralise a lot of stuff.
root@media-server:~# snap
Command 'snap' not found, but can be installed with:
apt install snapd
root@media-server:~#
bingo, maybe add in your script a check for snap as a dependency?
Ok I dug further into lxc territory and found that you have to enable nesting in an unprivileged container
- For unprivileged containers:
1) Put this in /etc/pve/lxc/vmid.conf: (change to the vmid like 100.conf)
Code:
...
features: mount=fuse,nesting=1
lxc.mount.entry = /dev/fuse dev/fuse none bind,create=file 0 0
2) Inside the container: `apt install squashfuse`
- For privileged containers, also add:
Code:
...
# EDIT:
# We need to allow apparmor administration, by default mac_admin is dropped for privileged containers.
# Note that you do not want this for un-trusted containers...
lxc.cap.drop =
lxc.cap.drop = mac_override sys_time sys_module sys_rawio
Alternatively to squashfuse, privileged containers could use loop devices, but I wouldn't recommend it...
Note that enabling `fuse` in a container does not play well with backups, or anything that causes an `lxc-freeze` command to be executed on the container, as this can cause deadlocks in the kernel...
how to force a reinstall of everything or reset it to run the script again?
To be honest I have never really delved in what you call lxc terrirory. So this all is new to me. I'll need to dive into this before I completely understand (thats because of how my brain is wired).
I will look into this because I'm always interested in things I have no knowledge of yet. I'm afraid I'm not confident enough at this moment to answer your last question. But I'll get back to you when I do.
I dont blame you its a rabbit hole. I ran your script on a clean VM and it works great
Great idea 🙂 And I already did. It will now stop the script and display an error that something went wrong with installing snap. Right before the step where it creates the symlink for snap.
awesome
That's an interesting idea. I'd be very Ok with creating an account for you on this website so you can write posts on the subject. That would actually be really great! Perhaps we should handle the details via email to make this happen?
Hi A,
awesome lets collaborate over a video teams conf, I can send the invite and we can work through how to do the workflow, this will be a great post and will blow up your blog, I guarantee it. with your automation capability and my testing blockchain it will be great.
Hi A I am ready to do this after upgrading my network and making it more stable. let me know when your ready, I will syndicate this from your site and on my forum https://forum.diode.io you can see my posts on various blockchain services with embedded devices and private cloud infrastructure. look forward to doing this finally
I'm sorry but somehow I missed it that this comment was still awaiting approval. I'm ready when you are!
The Funny part, Im wanting to do kinda the opposite of everyone... I actually want to disable the main website, but still use the m3u8 playlist option, any guidance on how to do this if its possible? My main reason for this I dont need the main page persay, as most of my viewers would use the m3u8 playlist option and not the direct https:// website. And the media server is doing everything I could ask for it. I actually use it to feed a preset audio/video stream into a private instance within a VR homeworld i use in VRchat, so most of the consumption of the information is pulled in there.