How to install Ant Media Server on Ubuntu Linux Server

Where necessary, you may need to have access to a VPS server so you can follow how to implement the steps in this article.  You can get a cheaper VPS Server from Contabo with 4vCPU cores, 8GM RAM, and 32TB Bandwidth for less than $5.50 per month. Get this deal here now

Table of Contents

Cloud VPS S

$5.50 Monthly
  • 4 vCPU Cores | 8GB RAM


$15.50 Monthly
  • 6 vCPU Cores | 16GB RAM


$17.50 Monthly
  • 8 vCPU Cores | 24GB RAM

Installing Ant Media on Ubuntu or any Linux VPS is very easy and it takes a few steps to complete. But first, you need to have a reliable VPS server, capable of providing you with sufficient computing resources for your live-streaming needs. The most affordable and best VPS provider on the market we recommend is Contabo. In a VPS market crowded with many providers out there, it’s very hard to find affordable and honest VPS providers

What is Ant Media Server?

Ant Media is an open-source engine that allows low-latency live streaming for any streaming scenario. Ant Media has the potential to cater to both small and large live-streaming audiences without compromising on the streaming quality.

Ant Media server is offered in two versions; Community and Enterprise licenses. The Community license is free but has some limitations in terms of performance optimization. Ant Media’s enterprise licenses are offered in various categories starting from $89 per month.

Installing Ant Media Sever on Linux VPS

Now, here are the steps we need to take to successfully install Ant Media on a Ubuntu VPS server

Open the SSH or Command terminal and Update

As a common habit in the Linux community, before installing any script, we need to first update our system using the following command;

sudo apt-get update

Download Ant Media on your Ubuntu server

The next step is to download the Ant Media server script on your server. The community license is free and you can directly download it from the Ant Media GitHub repository. If you’re going to use the enterprise license, then you must buy the script based on your needs. The Enterprise license comes with a License Key they provide you after purchasing. To buy the enterprise license, you need to head to the official Ant Media website

Back to your SSH terminal, use the following command to download the free community license on your server;

sudo wget

For an enterprise license, replace the download URL and use the wget command to download it. For example, the command should look like this;

sudo wget your_enterprise_license_download_link

Make sure you stay in the same directory where you’ve downloaded the ant media script. This is because the next commands we’re about to execute will require that you’re in the same directory where Ant Media has been downloaded.

RECOMMENDED READING: How to set up Nginx RTMP Server on Ubuntu to Live stream videos

Download the installation script on your Linux Server

The ant media installation script is a standalone script that makes it possible to install the ant media server on your machine. It’s a free script that can be downloaded by using the following command;

chmod 755

Again as a reminder, the script you’ve downloaded should be in the same directory as the Ant media zip file you downloaded. So, the installation script is named as

Run the installation script

Now, we need to run the installation script to be able to install Ant Media on our machine. Run the following command and make sure you replace ANT_MEDIA_SERVER_INSTALLATION_FILE with the zip file name containing the Ant Media files you first downloaded at the beginning


Check if Ant Media is running on Ubuntu

Now that you’ve successfully executed the installation, it’s time to check if Ant Media is running on your machine. Use the following command;

sudo service antmedia status

If the Ant Media service does not run automatically, then you need to start it by using the following command;

sudo service antmedia start

Alternatively, if you want to stop the Ant Media service, then just run the following command;

sudo service antmedia stop

RECOMMENDED: How to install a Graphical User Interface on Ubuntu Server

Open Ant Media Ports through Firewall

After installing Ant Media, you will need to configure some firewall rules to open the necessary ports required by the server to run. Ant Media requires the following ports to be open;

  • TCP:1935 needed for RTMP streaming
  • TCP:5080 is required to access the unencrypted HTTP admin URL of your server
  • TCP:5443 used for encrypted HTTPS admin URL of your Ant Media server
  • UDP:500065000, This port range is critical for WebRTC streaming

Open Ant Media ports using iptables on Ubuntu

iptables is one of the most commonly used firewalls on Linux servers. If you’re using another firewall, then you can skip this step. But to install iptables firewall, use the following command;

sudo apt-get install iptables

Now, verify if iptables firewall is running using the following command;

sudo systemctl status iptables

Okay, now let’s open the required ports using iptables.

  • Open TCP port 1935 by pasting the following command;
sudo iptables -A INPUT -p tcp --dport 1935 -j ACCEPT
  • Open TCP port 5080
sudo iptables -A INPUT -p tcp --dport 5080 -j ACCEPT
  • Open TCP port 5443;
sudo iptables -A INPUT -p tcp --dport 5443 -j ACCEPT
  • Open UDP port range from 5000 to 65000 necessary for WebRTC streaming
sudo iptables -A INPUT -p udp -m udp --dport 5000:65000 -j ACCEPT

Add Port forwarding rules using iptables on Ubuntu

As we know it, the default HTTP and HTTPS ports are 80 and 443 respectively. But Ant Media uses ports 5080 and 443 instead of the default HTTP/HTTPS ports.

Now, what needs is to forward the traffic from the default ports to the recommended Ant media ports using the iptables firewall. Here is how we do it;

  • Forward HTTP traffic from the default port 80 to port 5080
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5080
  • Forward HTTPS traffic from the default port 443 to port 5443
sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 5443

Install iptables-persistent package

This package helps us to ensure that the set firewall rules are reloaded even when the server abruptly reboots. Use the following command to download the iptables-persistent package

sudo apt-get install iptables-persistent

After installing the package, we need to enable the set iptables rule persistent using the following command;

sudo sh -c "iptables-save > /etc/iptables/rules.v4"

Accessing Ant Media Admin dashboard

You can access the ant media admin dashboard by browsing to the http version of the admin URL or its HTTPS URL version

The HTTP admin URL of ant media should look like as below and make sure you replace with your server IP address;

On the other hand, you can only use the HTTPS admin URL of ant media if you’ve installed an SSL certificate. And for an SSL certificate to be installed, you need to configure a domain name on your server. Basically, the HTTPS URL should be as below;

RECOMMENDED READING: Solved: Protect Ant Media Streams from getting embedded

Configuring SSL on Ant Media Server on Ubuntu

In most cases, without an SSL certificate installed on your ant media server, your streams are likely not to show in the player. The good thing is that Ant Media ships with a free SSL package that you can run in just one simple step.

Go to the Ant Media directory

This is the folder that contains all your ant media files and scripts. If you’re a root user, you can quickly run the following command to find this directory;

cd /usr/local/antmedia

Inside the ant media directory, we’re interested in the file named;, We will have to run this package to enable SSL. But first, let’s add the writable permission to the file by running the following command;

chmod 777

Run the SSL installation script for Ant Media.

We’re going to enable the SSL certificate on the server by executing the Make sure you’ve already configured the domain name on your server and that it has completed the propagation process. If so, then run the following command and make sure you insert the domain you configured with your server;


That’s all and happy streaming 🙂

More Ant Media Server articles to explore

Hire us to handle what you want

Hire us through our Fiverr Profile and leave all the complicated & technical stuff to us. Here are some of the things we can do for you:

  • Website migration, troubleshooting, and maintenance.
  • Server & application deployment, scaling, troubleshooting, and maintenance
  • Deployment of Kubernetes, Docker, Cloudron, Ant Media, Apache, Nginx,  OpenVPN, cPanel, WHMCS, WordPress, and more
  • Everything you need on AWS, IBM Cloud, GCP, Azure, Oracle Cloud, Alibaba Cloud, Linode, Contabo, DigitalOcean, Ionos, Vultr, GoDaddy, HostGator, Namecheap, DreamHost, and more.

We will design, configure, deploy, or troubleshoot anything you want. Starting from $10, we will get your job done in the shortest time possible. Your payment is safe with Fiverr as we will only be paid once your project is completed.