THE SOFTWARE

RASPBERRY PI OS

There are a lot of different operational systems that are compatible with the Raspberry Pi boards, but we decided to go with the official Raspbery distribution of linux, the Raspberry Pi OS that would give us the foundation to add the different modules that we needed for all the different services.

The first step was to generate an image of the Raspberry Pi OS that would run headless. An installation with SSH support enabled so we could access the server without keyboard, mouse and monitor. For that we donwnloaded and installed the Windows Raspberry Pi Imager and created an image on the SDHC card.
Then we enable SSH at the boot.

The second step was to insert the SDHC on the Raspberry Pi and start the system. Then we just needed to open the Windows command line and log to the system using the factory credentials for the Pi.

The next step was to enable the VNC service to be able to access the Raspberry Pi using a Remote Desktop connection.

After these steps we were able to have remote access to the system.

MOUNT DRIVE

After setting users and changing passwords, it was time to mount the drives in the system.

Fisrt we mounted the USB memory stick and adjusted the permissions, then we added the drive to the FSTAB table to have it mounted automatically at boot.

Drive mounted... what's next?

SAMBA SERVER

The next step was to install a file server to be able to share the Raspberry folders and files on the network. Samba is probably the most used file server in the world, so no surpises here.

Sharing the Raspberry drive was quick and easy. We added the "force name" option to have total control of the files saved on the drive.

Then we moved on to the existing network drive. This was a lot more complicated that antecipated because we needed to add support for NTFS and also enable the wait for lan option at boot. There are also a lot of details in the configuration and it took quite some time to get it right.

After making sure the drives were being mounted correctly, we edited the FSTAB configuration to map the drives so they would mount automatically when booting the system.

NGINX

After having the basic functions up and running, it was time to install and configure the web server that was going to handle the web services that we wanted. OwnCloud, Webserver and RTMP. For that we decided to go with Nginx instead of the more common Apache.

So we installed Nginx and added the optional RTMP module.

OWNCLOUD

Then we moved on to the installation of OwnCloud.

The first step was to install the MySQL Server - MariaDB and have it configured.

Then to install OwnCloud and, configure Nginx for it, and finally, get the SSL certificate to work.

At first we used the Nginx internally generated certificate, but it didn't took long to realize that we really needed one that was autenticated by a CA.

After some research we came across Let's Encrypt and so we installed their Certbot module and adjusted the server configuration for the new certificates.

Since we were using three different domains, it took a while to have them all working. Some unexpected issues with the OwnCloud domain could only be fixed with the addition of the "default_domain" option at the server configuration.

RTMP

One of the big incentives to embark on this journey was to be able to stream my music straight from my server, and for doing that we need two more pieces to add to the jigsaw. A RTMP server and the HLS service.

The RTMP server is the part of software that my OBS will connect to to broadcast the stream, and the HLS is the part that will slice the stream in small pieces to be able to serve over the HTTP protocol.

So we started installing the RTMP module from Nginx and then we moved to the configuration of the RTMP server.

REFERENCE

Raspberry Pi Imager

https://www.raspberrypi.org/software/

Raspberry Pi headless configuration

https://www.raspberrypi.org/documentation/remote-access/ssh/README.md

Raspberry Pi remote access

https://raspberrypi.org/documentation/remote-access/vnc/

Mount USB drive

https://pimyfifeup.com/raspberry-pi-mount-usb-drive/

Samba file server

https://pimylifeup.com/raspberry-pi-samba/

Nginx for OwnCloud

https://pimylifeup.com/raspberry-pi-owncloud/

RTMP and HLS

https://hlsbook.net/hls-nginx-rtmp-module/

by Bidhux