Operating System CentOS

How to Set Up Red5 Media Server on AlmaLinux 9 or Rocky Linux 9

Install Red5 2.0 on AlmaLinux 9, Rocky Linux 9 or CentOS Stream 9 with OpenJDK 21, run it as a systemd service and test RTMP publishing and playback.

This guide installs the open-source Red5 media server on AlmaLinux 9, Rocky Linux 9 or CentOS Stream 9, runs it under systemd as an unprivileged user, opens the firewall and tests it by publishing and playing an RTMP stream. CentOS 7 reached end of life in June 2024 and receives no more updates; the three distributions above are its RHEL 9 compatible replacements, and the commands here are identical on all of them.

Two things have changed about Red5 that affect what you can expect from it. Adobe Flash Player is gone, so the browser-based Flash demos that Red5 was once known for no longer work in any current browser. And the project now states plainly that the open-source server supports the RTMP protocol only: you publish to it with an encoder such as OBS Studio or FFmpeg and play back with an RTMP-capable player such as VLC or ffplay. Delivery to browsers over HLS, WebRTC and similar protocols is part of the vendor's commercial products, not of the open-source server.

Requirements

  • A server running AlmaLinux 9, Rocky Linux 9 or CentOS Stream 9 with at least 2 GB of RAM (the start script gives the JVM a heap of up to 1 GB by default).
  • A user with sudo rights.
  • Java 21. The 2.0.x release line of Red5 is compiled for Java 21. A newer 2.2.0 release exists and requires JDK 25; this guide uses 2.0.x, which GitHub marks as the latest release and which runs on the OpenJDK 21 packages in the distribution's own repository.
  • FFmpeg or OBS Studio on your own computer for testing.

Update the system and install Java 21

sudo dnf -y update
sudo dnf -y install java-21-openjdk-headless tar wget

Confirm the version and note where the runtime lives; the service needs that path as JAVA_HOME:

java -version
ls -d /usr/lib/jvm/jre-21-openjdk

If the second command reports that the path does not exist, list /usr/lib/jvm/ and use the Java 21 directory you find there in the unit file below. There is no need to download a JDK from Oracle or to juggle alternatives entries by hand.

Download and unpack Red5

Create a system account that owns and runs the server:

sudo useradd --system --home-dir /opt/red5 --shell /sbin/nologin red5

Look up the current 2.0.x version on the project's releases page and set it in a variable. Version 2.0.53 was current when this guide was written:

RED5_VERSION=2.0.53
cd /tmp
wget https://github.com/Red5/red5-server/releases/download/v${RED5_VERSION}/red5-server-${RED5_VERSION}.tar.gz

The archive contains a single top-level directory named red5-server. Unpack its contents into /opt/red5 and hand them to the service account:

sudo mkdir -p /opt/red5
sudo tar -xzf red5-server-${RED5_VERSION}.tar.gz -C /opt/red5 --strip-components=1
sudo chown -R red5:red5 /opt/red5

The directory now holds red5.sh (the start script), red5-shutdown.sh, the conf directory and webapps, which contains the default live application used for streaming.

Check the listening ports

Ports and bind addresses are set in /opt/red5/conf/red5.properties. The defaults are:

PropertyDefaultPurpose
http.port5080Built-in web server (welcome page)
rtmp.port1935RTMP publishing and playback
https.port5443HTTPS, once a keystore is configured
rtmps.port8443RTMP over TLS, once configured

Both http.host and rtmp.host default to 0.0.0.0, so the server listens on every interface. You only need to edit this file if another service already uses one of the ports.

Run Red5 as a systemd service

The release archive includes an init script and a red5.service file, but they depend on the separate jsvc launcher and pass JVM options written for much older Java versions. A small unit that calls red5.sh directly is simpler: the script ends by replacing itself with the Java process, so systemd supervises the JVM itself. Older tutorials start the server with sh red5.sh & or a SysV script in /etc/init.d; neither survives a crash or gives you logs in the journal.

Create the unit file:

sudo nano /etc/systemd/system/red5.service
[Unit]
Description=Red5 media server
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=red5
Group=red5
WorkingDirectory=/opt/red5
Environment=RED5_HOME=/opt/red5
Environment=JAVA_HOME=/usr/lib/jvm/jre-21-openjdk
ExecStart=/opt/red5/red5.sh
SuccessExitStatus=143
Restart=on-failure
RestartSec=10
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

SuccessExitStatus=143 tells systemd that a JVM stopped with SIGTERM exited normally. To change the heap size, add a line such as Environment="JVM_OPTS=-XX:+UseG1GC -Xms512m -Xmx2g"; setting JVM_OPTS replaces the script's defaults entirely.

Load the unit, start the server and enable it at boot:

sudo systemctl daemon-reload
sudo systemctl enable --now red5
systemctl status red5

Startup takes a few seconds. Follow it in the journal and check that both ports are open:

sudo journalctl -u red5 -f
sudo ss -tlnp | grep -E ':(5080|1935)'

Open the firewall

With firewalld active, allow the web port and RTMP:

sudo firewall-cmd --permanent --add-port=5080/tcp
sudo firewall-cmd --permanent --add-port=1935/tcp
sudo firewall-cmd --reload

If your provider has a separate network firewall in its control panel, open the same two ports there. SELinux can stay in enforcing mode; the service runs from /opt without needing extra policy.

Verify the installation

Open http://203.0.113.10:5080/ in a browser (use your server's address). The Red5 welcome page confirms that the embedded web server is running.

Then test actual streaming. On your own computer, publish a generated test pattern to the live application with FFmpeg; test is the stream name and can be anything:

ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 -f lavfi -i sine=frequency=440 \
  -c:v libx264 -preset veryfast -pix_fmt yuv420p -g 60 -c:a aac -b:a 128k \
  -f flv rtmp://203.0.113.10/live/test

While that runs, play the stream from a second terminal:

ffplay rtmp://203.0.113.10/live/test

VLC works as well: choose Media → Open Network Stream and enter the same URL. In OBS Studio, set the stream service to Custom, the server to rtmp://203.0.113.10/live and the stream key to the stream name.

Maintenance

  • Logs: journalctl -u red5 shows the console output; the server also writes log files under /opt/red5/log, configured in conf/logback.xml.
  • Restarting: sudo systemctl restart red5 after any change in /opt/red5/conf.
  • Upgrading: stop the service, move /opt/red5 aside as a backup, unpack the new release as shown above, copy your edited files from the old conf directory and any applications you added to webapps, fix ownership with chown -R red5:red5 /opt/red5 and start the service again.
  • Access control: out of the box, anyone who can reach port 1935 can publish to the live application. Until you add authentication in your own Red5 application, restrict port 1935 to the addresses of your encoders with a firewalld rich rule or your provider's firewall.

Frequently asked questions

Can viewers watch a Red5 stream in a web browser?

Not directly. Browsers cannot play RTMP since Flash Player was retired, and the open-source server speaks RTMP only. Either use a desktop or mobile player that supports RTMP, or put a repackaging step in front of the audience, for example FFmpeg pulling the RTMP stream and writing HLS segments that a web server delivers. If browser delivery is the main goal, a server with built-in HLS or WebRTC output is a better fit than open-source Red5.

Which Red5 release line should I install, 2.0.x or 2.2.x?

Both were being released in November 2026. The 2.0.x line targets Java 21, which every RHEL 9 compatible distribution ships. Release 2.2.0 raised the baseline to JDK 25, so choose it only if you have a Java 25 runtime installed and change JAVA_HOME in the unit file to match.

Why does the service fail with "Please set JAVA_HOME"?

red5.sh does not search for Java; it runs $JAVA_HOME/bin/java. The message means the path in the Environment=JAVA_HOME= line does not contain bin/java. Check the directory name under /usr/lib/jvm/, correct the unit file, then run sudo systemctl daemon-reload and restart the service.

How do I record incoming streams?

Recording is a feature of the Red5 application that receives the stream, not a global server switch. The bundled live application only relays. To record, deploy an application that calls the server-side stream recording API, or simply run FFmpeg as a second subscriber and save the stream with ffmpeg -i rtmp://127.0.0.1/live/test -c copy recording.flv.

Share story:

Continue reading other guides on How VPS.