Ant Media Server on Ubuntu 18.04

This short guide will show you how to install Ant Media Server (Community Edition) on a Ubuntu 18.04 VPS server. Ant Media Server is a fork of Red5.

The community Edition is free, but it does have it’s limitations that can be unlocked by purchasing a license. It runs on Java so we’re also installing that on our server.

The server that I used in this example has Nginx installed and running with the additional RTMP module on port 1935. Ant Media Server will also require this port so to avoid any conflicts we need to stop Nginx before anything else. I also choose to disable it temporary but you don’t need to do this.

systemctl stop nginx
systemctl disable nginx

Another option you have to avoid conflicts is to change the port Nginx uses for RTMP by changing it in your /etc/nginx/nginx.conf file as shown on the image.

Let’s start by installing the default java (version 8) for Ubuntu.

apt install -y openjdk-8-jdk openjdk-8-jre
java -version

You must have to set JAVA_HOME and JRE_HOME environment variables, which is used by many of the Java applications to find Java libraries during runtime. You can set these variables in /etc/environment file using the following command.

cat >> /etc/environment <<EOL JAVA_HOME= /usr/lib/jvm/java-8-openjdk-amd64 JRE_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre EOL
wget https://github.com/ant-media/Ant-Media-Server/releases/download/ams-v2.0.0/ant-media-server-2.0.0-community-2.0.0-20200504_1842.zip
unzip ant-media-server-2.0.0-community-2.0.0-20200504_1842.zip
cd /opt/ant-media-server
wget https://raw.githubusercontent.com/ant-media/Scripts/master/install_ant-media-server.sh && chmod 755 install_ant-media-server.sh
sudo ./install_ant-media-server.sh ant-media-server-2.0.0-community-2.0.0-20200504_1842.zip
service antmedia status

http://SERVER_IP_ADDRESS:5080

In order to server run properly you need to open some network ports.

  • TCP:1935 (RTMP)
  • TCP:5080 (HTTP)
  • TCP:5443 (HTTPS)
  • UDP:5000-65000 (WebRTC)
  • TCP:5000-65000 (You need to open this range in only cluster mode for internal network. It should not be open to public.)
sudo ufw allow 1935/tcp
sudo ufw allow 5080/tcp
sudo ufw allow 5443/tcp

CLUSTER MODE ONLY
sudo ufw allow 5000:65000/udp

We’re done for now. Everything should be working now. A logical next step would be to install certificates and enable secure live-streaming. More about that on this page: https://github.com/ant-media/Ant-Media-Server/wiki/SSL-Setup

There’s a well written Wiki on the project’s github pages. You can use this if you run in to any issues. No need to click the link below at this moment because then you will see that I basically copy / pasted this whole page. In other words: I stole content. Sue me.. At least I’m honest about it.

https://github.com/ant-media/Ant-Media-Server/wiki/Installation

Leave a Reply

Your email address will not be published. Required fields are marked *