How to Install SRS on Arch Linux

SRS (SimpleRtmpServer) is an open-source live streaming server for Linux, which provides support for live streaming protocols such as RTMP, HTTP, HLS, and many others. In this tutorial, we will guide you through the process of installing SRS on Arch Linux.

Prerequisites

Installing SRS

To install SRS on your Arch Linux system, follow the steps below:

Step 1: Install the required dependencies

Before installing SRS, you need to install the required dependencies on your system. Open the terminal and run the following command:

sudo pacman -S nginx ffmpeg openssl pcre

Step 2: Download the SRS source code

Download the latest version of the SRS source code from the official website using the following command:

wget https://github.com/ossrs/srs/archive/refs/tags/v5.2.tar.gz

Step 3: Extract the SRS archive

Extract the downloaded SRS archive using the following command:

tar -xvzf v5.2.tar.gz

Step 4: Install the SRS server

Now, change the directory to the extracted SRS source code directory:

cd srs-5.2/trunk

Compile and install the SRS server with the following command:

sudo ./configure --with-nginx && sudo make && sudo make install

Step 5: Configure SRS

Create a configuration file for SRS by copying the sample configuration file:

sudo cp conf/srs.conf.sample conf/srs.conf

Now, edit the SRS configuration file with the following command:

sudo nano conf/srs.conf

Change the following parameters to suit your requirements:

listen              1935;               
chunk_size          60000;              
vhost __defaultVhost__ {
    #rtmp settings
    # live stream settings
    live on;
    # whether open the cluster
    cluster {
            # whether to use central control
            center        on;
            server {
                    # the cluster server ip and port
                    ip        127.0.0.1;
                    port        8085;
            }
    }
}

Also, make sure to configure the HTTP API authentication parameters.

http_hooks {
        # the http server where to enable hooks
        listen                  8085;

        # the hook event where to notify the hook
        on_connect              http://127.0.0.1/api/v1/people/connected;
        on_close                http://127.0.0.1/api/v1/people/disconnected;

        # the flash video control
        flash {
                allow               true;
                # whether to check the swf hash value from the client
                swf_hash            on;
                swf_url             http://127.0.0.1/static/player/player-2.0.4.swf;
        }

        # the dvr to cache the stream in hls/m3u8/vod type.
        dvr {
                enable              true;
                dvr_plan            session;
                dvr_duration        30;
                dvr_wait_keyframe   true;
        }
}

http_api {
        # the http server where to enable api
        listen              8080;

        # the crossdomain xml file content
        crossdomain_xml     "<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from domain=\"*\"/></cross-domain-policy>";
        # whether enable the swagger ui, default is false.
        swagger             off;
        # the api restful http processor, default is off.
        restful             on;
        # whether the http api is authenticated
        # others is srs-server.demo.cloudcdn.net
        auth {
                enabled         on;
                passwd          foobar; # the api passwd, read/write
                publish_pass    isyourpower; # the publish auth, write
                # the following is the api entry
                entry {
                        enabled         on;
                        pattern         /*;
                        require         publish;
                }
        }
        # the allowed client ips, default to all.
        allowed_ips         127.0.0.1;
}
log {
    # whether print the basic access log, default to off.
    access                  off;
    # whether print the detail trace log, default to info.
    detail                  off;
}

Step 6: Start SRS

After configuring SRS, start the server using the following command:

sudo service srs start

You can also enable SRS to start on system boot by running the following command:

sudo systemctl enable srs

Conclusion

That's it! You have successfully installed SRS on Arch Linux. You can now use this powerful live streaming server to stream and broadcast your content over the internet.

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!