How to Install SRS on Elementary OS Latest

SRS (Simple Realtime Server) is an open-source live streaming server that supports HTTP-FLV, RTMP, HLS, RTSP and WebRTC streaming protocols. In this tutorial, we will guide you through the steps to install SRS on your Elementary OS.

Prerequisites

Step 1: Update the System

First, let's update the system to make sure everything is up-to-date.

sudo apt update
sudo apt upgrade

Step 2: Install SRS Dependencies

Before installing SRS, we need to install some dependencies required to build and run SRS.

sudo apt install -y build-essential git cmake libssl-dev zlib1g-dev libasound2-dev libavcodec-dev libavformat-dev libavutil-dev libboost-dev libev-dev libcurl4-openssl-dev libmagic-dev libevent-dev libspdlog-dev ffmpeg

Step 3: Download and Build SRS

Now, let's download SRS source code from Github and build it.

git clone https://github.com/ossrs/srs.git
cd srs
git checkout 4.0release
./configure --full --disable-all --with-ssl --with-librtmps --with-librtmp --with-libfdk-aac --with-libopus --with-libvpx --with-libmp3lame
make

Step 4: Test SRS

After building SRS, it's time to test if it works. Run SRS with the default configuration and check if there are any errors.

./objs/srs -c conf/srs.conf

If everything is working fine, you should see some messages like this:

[SrsApp] listening at: rtmp://0.0.0.0:1935/live?vhost=_defaultVhost_

Step 5: Run SRS as a Service

To run SRS as a service, run the following command to create a new file for SRS in the /etc/systemd/system/ directory.

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

Paste the following configuration in the file.

[Unit]
Description=Simple Realtime Server
After=network.target

[Service]
Type=simple
User=srs
Group=srs
ExecStart=/root/srs/objs/srs -c /root/srs/conf/srs.conf

[Install]
WantedBy=multi-user.target

Save and close the file by pressing Ctrl and X.

Start SRS service by running the following commands.

sudo systemctl daemon-reload
sudo systemctl start srs.service

Check if the service is running by running the following command.

sudo systemctl status srs.service

If SRS is running as a service, you should see "Active: active (running)" in the output.

Conclusion

In this tutorial, we have shown you how to install SRS on Elementary OS Latest. With SRS installed, you can now live stream your content using different protocols.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!