Some quotes by some guy

“Because in the end, you won’t remember the time you spent working in the office or mowing your lawn. So climb that goddamn mountain.” — Jack Kerouac

“Things are so hard to figure out when you live from day to day in this feverish and silly world. ” — Jack Kerouac

“Happiness consists in realizing it is all a great strange dream.” — Jack Kerouac

“Let the mind beware, that though the flesh be bugged, the circumstances of existence are pretty glorious.” — Jack Kerouac

“Things are so hard to figure out when you live from day to day in this feverish and silly world. ” — Jack Kerouac

Setup a Nginx RTMP live-stream server & HLS video-player on a WordPress site on Ubuntu/Raspbian/Debian

0. PRE-PREPARATION

This guide was written up by André, that would be me, to accompany a new video on my Youtube channel. The video will be uploaded somewhere during the next two days so make sure you keep an eye on that!! In the video I follow my own written guide, make some adjustments here and there. I posted the end-results below the video here.

All the commands are also available on Pastebin (right here)
Get WinSCP here, and Putty here.

1. PREPARATION

Continue reading

Ant Media Server on Ubuntu 18.04

This short guide will show you how to install Ant Media Server (Community Edition) on a Ubuntu 18.04 VPS server. Ant Media Server is a fork of Red5.

The community Edition is free, but it does have it’s limitations that can be unlocked by purchasing a license. It runs on Java so we’re also installing that on our server.

The server that I used in this example has Nginx installed and running with the additional RTMP module on port 1935. Ant Media Server will also require this port so to avoid any conflicts we need to stop Nginx before anything else. I also choose to disable it temporary but you don’t need to do this.

systemctl stop nginx
systemctl disable nginx

Another option you have to avoid conflicts is to change the port Nginx uses for RTMP by changing it in your /etc/nginx/nginx.conf file as shown on the image.

Let’s start by installing the default java (version 8) for Ubuntu.

apt install -y openjdk-8-jdk openjdk-8-jre
java -version

You must have to set JAVA_HOME and JRE_HOME environment variables, which is used by many of the Java applications to find Java libraries during runtime. You can set these variables in /etc/environment file using the following command.

cat >> /etc/environment <<EOL JAVA_HOME= /usr/lib/jvm/java-8-openjdk-amd64 JRE_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre EOL

Make sure you look for the latest version yourself on the github. At the time of creating this guide this was a direct download to the latest one.

wget https://github.com/ant-media/Ant-Media-Server/releases/download/ams-v2.1.0/ant-media-server-2.1.0-community-2.1.0-20200720_1340.zip
unzip ant-media-server-2.0.0-community-2.0.0-20200504_1842.zip
cd /opt/ant-media-server
wget https://raw.githubusercontent.com/ant-media/Scripts/master/install_ant-media-server.sh && chmod 755 install_ant-media-server.sh
sudo ./install_ant-media-server.sh ant-media-server-2.0.0-community-2.0.0-20200504_1842.zip
service antmedia status

Now open http://SERVER_IP_ADDRESS:5080 and create a new admin account or yourself.

In order to server run properly you need to open some network ports.

  • TCP:1935 (RTMP)
  • TCP:5080 (HTTP)
  • TCP:5443 (HTTPS)
  • UDP:5000-65000 (WebRTC)
  • TCP:5000-65000 (You need to open this range in only cluster mode for internal network. It should not be open to public.)
sudo ufw allow 1935/tcp
sudo ufw allow 5080/tcp
sudo ufw allow 5443/tcp

CLUSTER MODE ONLY
sudo ufw allow 5000:65000/udp

Enable SSL certificates

To obtain a certificate for Ant media server you can choose to create a new one or import it from an already existing certificate. I choose in this example to create a new one. PLEASE NOTE! The cert. creation process will need to use port 80 for its validation. So if you have Apache or Nginx already running, disable it for a moment using systemctl stop apache2/nginx.

cd /usr/local/antmedia
sudo ./enable_ssl.sh -d {DOMAIN_NAME}

I hope I don’t have to explain that you should replace the {DOMAIN_NAME} with your own hostname/domainname. Don’t forget to restart the Apache or Nginx process that you might have stopped earlier.

If you already have created certificates for the domain you want to use, another option would be to use those, like this:

sudo ./enable_ssl.sh -f yourdomain.pem -p privkey.pem -d yourdomain.com

For more information and help with seting up SSL please check out the Wiki.

Now you can open the interface to the server on http://yourdomain:5443

We’re done for now. Everything should be working now. A logical next step would be to install certificates and enable secure live-streaming. More about that on this page: https://github.com/ant-media/Ant-Media-Server/wiki/SSL-Setup

There’s a well written Wiki on the project’s github pages. You can use this if you run in to any issues. No need to click the link below at this moment because then you will see that I basically copy / pasted this whole page. In other words: I stole content. Sue me.. At least I’m honest about it.

https://github.com/ant-media/Ant-Media-Server/wiki/Installation

Fix the Nginx module in Webmin (Ubuntu 18.04)

For a long time now, the Nginx plugin that exists for Webmin did not work after installing it on Ubuntu/Debian. I never got around to figure out how to fix this but today I did. Here’s how to fix the Nginx plugin in Webmin on a Ubuntu server.

Now in all honesty I have no idea what step of all the steps below did the trick of actually getting it to work, but I’m guessing it had something to do with the brackets in the config file. I still need to try this out on a different server without installing the Perl modules first. You’re free to experiment yourself if you dare. If so, let me know what the specific fix was.

First of course you need to install the Nginx module for Webmin. It’s a third party module so add it using the correct option on the screen you see here.

Search for Nginx, select it and install it. Once it is installed you will find the tab on the left under Servers. If not, refresh your modules first. Chances are very likely that you will see a page with some errors that are Perl related. If this is the case continue to follow these steps.

In webmin open the Others tab, and then Perl Modules. Choose “From CPAN, named” and search for DBD::mysql and installit. Do the same thing for all of the following:

HTML::Entities
DBI
GD
DBD::mysql

If you run into any problems you can alternatively install the plugin through the command line. To start first use this command:

perl -MCPAN -e shell

Now you can install any plugin by entering:

i HTML::Entities

When it’s installed optionally do a “reload cpan” or install more plugins. Use te “quit” command to exit the perl inputline. If you’re running the earlier mentioned command for the first time you might also want to start of with “install CPAN” and “reload CPAN

Next step may seem difficult but it really isn’t. We need to add some \ to a config file. So edit the following file and make the changes I placed below.

nano /usr/share/webmin/nginx/nginx-lib.pl

Go to line 199 and add a backslash before the opening bracket.

if ($if ($line =~ /server \{$/) {

Do not forget to add a backslash before the closing bracket on line 202.

if ($line =~ /\}$/) {

Save the file and now it should work after refreshing the Webmin Nginx page.

Build a live-stream server

This guide will show you step by step how to install Nginx webserver & Certbot SSL certificates, the RTMP module, Ffmpeg on a Ubuntu 18.04 VPS server. It will then will also explain how to setup HLS live-streaming and create a webpage with Video.JS to show the live-stream.
I decided to write this guide after receiving a lot of questions and responses on a video or two that I made a while ago. HLS and SSL related mostly. So hopefully this guide will clear up all of those questions for you all. If not, please leave any questions at the bottom of this page or as comment on the Youtube page.

This guide contains 7 steps. I strongly advice to read through them all beforehand so you’ll know what you’re doing in stead of just blindly start copy/pasting everything, because that rarely works out like it should, in my experience. This looks like a long-ass guide, and it is in a way, but you could do this all in under 25 minutes. Anyways, it’s too long for this blog’s layout so click on the continue reading link below to read the full article and to see the video.

EDIT 24-07-2020 – Take a look at the git repo for easy hls site instal by Quinn Ebert. He has created it based on my guide and video. Thanks Quinn! Good work 🙂

Continue reading