How to Install and Configure Red5 Media Server on CentOS

Introduction

Red5 is an open-source media server designed for audio/video streaming, live broadcasting, recording, and real-time communication. It enables organizations to deploy their own streaming infrastructure and deliver live or on-demand content directly from their servers.

This guide provides step-by-step instructions for installing and configuring Red5 on a CentOS server, enabling live streaming, publishing media, and embedding streams into websites.

By the end of this tutorial, you will have a working Red5 installation capable of hosting and streaming media content to your users.


Prerequisites

Before you begin, ensure that:

  • You have root or sudo access to the server.
  • The server has internet connectivity.
  • Required firewall ports are open.
  • Java is installed and properly configured.

Step 1: Install Java

Red5 requires Java to run.

yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel

Verify the installation:

java -version

Step 2: Install Apache Ant

Check whether Ant is available through the package manager:

yum list | grep ant
yum install ant

If Ant is not available through Yum:

cd /root/tmp
wget http://apache.mirrors.pair.com/ant/binaries/apache-ant-1.8.2-bin.tar.gz
tar -zxvf apache-ant-1.8.2-bin.tar.gz
mv apache-ant-1.8.2 /usr/local/ant

Verify installation:

ant -version

Step 3: Configure Java and Ant Environment Variables

Set the required environment variables:

export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/lib/jvm/java
export PATH=$PATH:/usr/local/ant/bin
export CLASSPATH=.:$JAVA_HOME/lib/classes.zip

Make the changes persistent:

echo 'export ANT_HOME=/usr/local/ant' >> /etc/bashrc
echo 'export JAVA_HOME=/usr/lib/jvm/java' >> /etc/bashrc
echo 'export PATH=$PATH:/usr/local/ant/bin' >> /etc/bashrc
echo 'export CLASSPATH=.:$JAVA_HOME/lib/classes.zip' >> /etc/bashrc

Reload the configuration:

source /etc/bashrc

Step 4: Install Required Dependencies

Install Perl URI and Subversion:

yum install perl-URI
yum install subversion

Troubleshooting

If Subversion installation fails due to package exclusions, temporarily remove the Perl exclusion from:

/etc/yum.conf

Install Subversion and then restore the original configuration.


Step 5: Download and Build Red5

Download the Red5 source code:

svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5
mv red5 /usr/local/

Build Red5:

cd /usr/local/red5

ant prepare
ant dist
cp -r dist/conf .

Step 6: Start Red5

Launch the Red5 server:

./red5.sh &

Verify that the service is running:

netstat -tulpn | grep 5080

Red5 should now be accessible on port 5080.


Step 7: Configure Red5 as a Service

To ensure Red5 starts automatically after a reboot:

cd /etc/init.d/

wget http://www.sohailriaz.com/downloads/red5.txt
mv red5.txt red5

chmod +x red5

service red5 start

Verify service status:

service red5 status

Important: Running Red5 directly from a terminal session may cause the process to stop when the session ends. Running it as a service or inside a screen session is recommended.


Step 8: Install the Red5 Administration Plugins

Create the plugins directory:

mkdir -p /usr/local/red5/plugins

Download the administration plugin:

cd /root/tmp

wget http://red5.googlecode.com/files/AdminPlugin-1.0.zip

unzip -d /usr/local/red5/plugins AdminPlugin-1.0.zip

Install the user registration page:

mkdir -p /usr/local/red5/webapps/admin

wget http://red5.googlecode.com/files/admin.jsp

mv admin.jsp /usr/local/red5/webapps/admin/

Accessing the Administration Interface

User Registration Page

http://SERVER_IP:5080/admin/admin.jsp

Administration Panel

http://SERVER_IP:5080/demos/adminPanel.html

Testing the Red5 Installation

Verify functionality using the publisher demo:

http://SERVER_IP:5080/demos/publisher.html

Steps:

  1. Open the publisher page.
  2. Replace localhost with the server IP address.
  3. Click Connect.
  4. Select a sample video.
  5. Start playback.

If the video plays successfully, Red5 is functioning correctly.


Live Streaming Configuration

Once Red5 is working correctly, you can begin live streaming.

Step 1: Open the Publisher

Navigate to:

http://SERVER_IP:5080/demos/publisher.html

Step 2: Connect to the Streaming Server

Select Server and configure:

rtmp://SERVER_IP/oflaDemo

Click Connect.

Step 3: Configure the Camera

  1. Select Video.
  2. Choose your local camera device.
  3. Click Apply.

Step 4: Publish the Stream

  1. Set stream type to Live.
  2. Enter a stream name.

Example:

sample
  1. Click Publish.

View the Live Stream

Open the Red5 demo player and configure:

Stream Server

rtmp://SERVER_IP/oflaDemo

Stream Name

sample

Click:

Update Preview & Code

The generated preview should display the live stream.


Embed the Stream on a Website

Copy the generated embed code from the demo player.

Create a web page:

test.html

Paste the generated code into the file.

Download the required media player components:

http://www.longtailvideo.com/jw/upload/mediaplayer-viral.zip

Extract the files into the same web directory.

Open the page in a browser and click Play to view the live stream.


Troubleshooting

Verify Red5 is Running

ps aux | grep red5

Check Listening Ports

netstat -tulpn | grep 5080

Review Logs

tail -f /usr/local/red5/log/*.log

Firewall Configuration

Ensure port 5080 is accessible from external networks.


Conclusion

Red5 provides a powerful open-source platform for media streaming and real-time communication. By following this guide, you can install Red5 on a CentOS server, configure live streaming, publish video feeds, and embed streams directly into your website. For production environments, consider configuring automatic service startup, monitoring, SSL termination, and firewall hardening to ensure reliable and secure streaming services.


Frequently Asked Questions (FAQ)

1. What is Red5?

Red5 is an open-source media server that supports audio streaming, video streaming, live broadcasting, recording, and real-time communication applications. It is commonly used for RTMP-based streaming solutions.


2. Which port does Red5 use by default?

Red5 listens on port 5080 for web applications and demonstrations.

Example:

http://SERVER_IP:5080

Ensure that the port is allowed through the server firewall.


3. How can I verify that Red5 is running?

Use the following commands:

ps aux | grep red5

or

netstat -tulpn | grep 5080

If Red5 is running correctly, port 5080 should be listening for connections.


Related Articles

  1. Install Nginx, PHP-FPM, and MariaDB on CentOS 7
    Learn how to build a complete web hosting stack that can be used alongside Red5 for web applications and streaming portals.
    Install Nginx, PHP-FPM, and MariaDB on CentOS 7
  2. MySQL FIND_IN_SET with Multiple Search Strings
    Improve database query performance and handle multiple search values efficiently in MySQL applications integrated with your streaming platform.
    MySQL FIND_IN_SET with Multiple Search Strings
  3. Install Fail2Ban on CentOS 7
    Secure your Linux server against brute-force attacks and unauthorized access attempts by implementing Fail2Ban protection.
    Install Fail2Ban on CentOS 7

admin

Writes about Web & Architecture at Pheonix Solutions.

Leave a Reply

Scroll to Top