disqus4u

How can I install Ant Media Server on Ubuntu?

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

CLOUD VPS M

$15.50 Monthly
  • 6 vCPU Cores | 16GB RAM

CLOUD VPS L

$17.50 Monthly
  • 8 vCPU Cores | 24GB RAM

Ant Media is supported on Ubuntu starting from 18.04 to 20.04 and 22.04 and the following are the steps you complete to install it;

In this article, I am assuming that you already have SSH access to your server

Download Ant Media Script

This is usually a zip file that contains all the Ant Media files. You either choose to download the Ant Media Community edition which is free or the Ant Media Enterprise Edition which is a paid edition. The latest free Ant Media Community builds can be accessed via their GitHub Repository. But if you want to deploy the enterprise edition of the software, then you will have to purchase and download it from the official Ant Media website.

For demonstration purposes, we will use the Ant Media Community Edition v2.5.2 and we will download it by running the following command;

wget https://github.com/ant-media/Ant-Media-Server/releases/download/ams-v2.6.2/ant-media-server-community-.zip

Now you need to verify if the zip file named; ant-media-server-community-.zip has successfully downloaded by running the ls command as follows;

ls

If it has successfully downloaded, you will be able to see this file listed in the current directory you’re operating in. Please mark the exact name of this file as we will need it in the next steps

Download the Ant Media Installation Script

The Ant Media installation script is a standalone script and is different from the Ant Media zip file we downloaded earlier. This script is what we used to execute the installation of the Ant Media Server. And so, we also need to download it by running the following command;

wget https://raw.githubusercontent.com/ant-media/Scripts/master/install_ant-media-server.sh && chmod 755 install_ant-media-server.sh

The above command will download a script named; install_ant-media-server.sh and then assign it the write, read and execute file permissions.

To be sure if the installation script has successfully downloaded, you can use the ls command again.

Run the installation

Now that we have everything we need, we can run the installation of Ant Media on our server using the following command;

sudo ./install_ant-media-server.sh -i ant-media-server-community-.zip

You will notice that the above command, install_ant-media-server.sh is the Ant Media installation script and ant-media-server-community-.zip is the zip file containing the core code of the Ant Media software.

Once you’ve run the above command, you will need to be patient so the installation process completes.

Assuming the installation has completed, you can access your Ant Media Admin web Panel using the Server IP address, appended with the default Ant Media HTTP port 5080. So, the link should as seen below;

http://server-ip-address:5080/

Please replace the server-ip-address above with the actual public IP address of your server.

Open Ant Media Ports through the Firewall

Ubuntu Linux comes with iptables firewall preinstalled. And this is what we’re going to use to open the Ant Media ports.

Open TCP Port 22

Whenever you activate the firewall configurations and settings on Ubuntu, the first thing you need to do is open the SSH port to avoid getting locked out of the system. If you don’t open this port after activating the firewall, you’re going to lose access to the system once the system reboots or abruptly shuts down. You can open SSH port by running the following command using iptables firewall;

sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT

Open TCP Port 1935

This port is needed by Ant Media for RTMP configurations and streaming and we can open it using the iptables firewall by running the following command;

sudo iptables -A INPUT -p tcp --dport 1935 -j ACCEPT

Open TCP port 5080

Ant Media server uses Port 5080 as its default HTTP port to enable you to access the Web admin Panel as we’ve seen earlier in earlier in this article. We can open this port using the iptables firewall by running the following command;

sudo iptables -A INPUT -p tcp --dport 5080 -j ACCEPT

Open TCP Port 5443

Ant Media uses Port 5443 as its default HTTPS port to use the encrypted version of the Web-based admin panel. This port is highly needed if you’re going to add a domain name and install an SSL certificate on your Ant Media server. Similarly, we can use iptables to open this port by running the following command;

sudo iptables -A INPUT -p tcp --dport 5443 -j ACCEPT


Open UDP port range 5000-65000 

Ant Media requires this UDP port for WebRTC streaming and we can open it by running the following iptables command;

sudo iptables -A INPUT -p udp -m udp --dport 5000:65000 -j ACCEPT

Ant Media Port Forwarding

We have to redirect the HTTP traffic from the default port 80 to Ant Media’s default HTTP port, which is 5080. We can achieve this by running the following iptables command;

sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5080

Similarly, if you’ve or you’re planning to use an SSL certificate on Ant Media, we will also need to redirect traffic from the default HTTPS port 443 to Ant Media’s default Port 5443. And here is the iptables command to achieve this;

sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 5443

Save iptables rules

After configuring all the firewall rules critical to Ant Media server, we need to make sure that they’re saved so that when the system reboots, these very rules will not be lost. To achieve this, we will need to install the iptables-persistent package by running the following command;

sudo apt-get install iptables-persistent

And finally, we can save the rules by running the following command;

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

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. 

Further Reading