Verified and Tested 09/3/15

Introduction

In this how-to we will walk you through the basic installation of an RTMP server using Ubuntu 14.04. RTMP stands for Real Time Messaging Protocol. This protocol has the ability to project or stream live videos, games, images and much more directly from your server and into the internet.

Prerequisites

You need a Ubuntu 14.04 server that is configured with a static IP address. If you do not have a server already, spin up our scalable and flexible Cloud Hosting in under 30 seconds.

We must make sure that the server is up to date with the following command:

sudo apt-get update

We will also need unzip which can be installed with the following command:

sudo apt-get install unzip

Installing Nginx for use with RTMP

First, we need to get the correct build tools to lay the foundation. They can be installed with the
following command:

sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev

Once we have downloaded the build tools we need to begin with the web server. We will be using Nginx and it can be installed with the following command:

wget http://nginx.org/download/nginx-1.8.0.tar.gz

Now, unpack the tar.gz file that we just downloaded with the following command:

tar -zxvf nginx-1.8.0.tar.gz

Additionally, we need to install the RTMP module. This can be installed with the following command:

wget https://github.com/arut/nginx-rtmp-module/archive/master.zip

Now, unzip the module file with the following command:

unzip master.zip

Once both packages are extracted, let us change our current directory to the Nginx directory with the following
command:

cd nginx-1.8.0

To complete the installation, we will need to build Nginx with the RTMP module with the following commands:

./configure --add-module=../nginx-rtmp-module-master
make
sudo make install

Finally, to conclude the installation, we must start Nginx so we can verify if there are no errors. Start nginx with the
following command:

sudo /usr/local/nginx/sbin/nginx

Then stop the service with the following command:

sudo /usr/local/nginx/sbin/nginx -s stop

Configure Nginx with RTMP

In order for Nginx to fully function with RTMP, we must configure it accordingly. Using you favorite text editor, open up your Nginx configuration file with the following command:

nano /usr/local/nginx/conf/nginx.conf

Now, since there are so many ways to configure RMTP, we will just cover enough information to get RTMP live and running forwarding the streams to anyone who requests it. Scroll to the bottom of the configuration file and pasted the following code:

rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                        live on;
                        record off;
                }
        }
}

Now we must restart Nginx so all the configurations take effect with the following command:

sudo /usr/local/nginx/sbin/nginx -s reload

Additional Configurations

At this point, your server is all set up and configured with RMTP. However, to begin  streaming,  you can  download “Open Broadcaster Software “software free of charge and configure the broadcast settings to the following:

Streaming Service: Custom
Server: rtmp://your.ip.add.ress/live
Play Path/Stream Key: mystreamkey

Finally, to request the RTMP, type the following link replacing the information with yours:

rtmp://your.ip.add.ress/live/mystreamkey

What’s Next?

Congratulations! This completes our how-to Installing RTMP on Ubuntu 14.04. You are now ready to begin streaming live videos, games, images and much more. Thank you for following along this how-to! Check back with us for further updates, and try out one of our many solid state cloud hosting solutions.