Installing AMS on Linux
  • 24 Jul 2022
  • 3 Minutes to read
  • Dark
    Light

Installing AMS on Linux

  • Dark
    Light

Ant Media can be installed on Linux, particularly Ubuntu and CentOS distributions. In order to run AMS on a single instance, you need at least 4GB of RAM. And SSD disks are highly recommended for write/read performance.

This document explains the installation of both Community Edition and Enterprise Edition. There are several methods of installing, including deployment to a full VM, Docker or Kubernetes.

Installing on Linux

1. Download Ant Media Server (AMS)

Download and save the latest AMS Community Edition or Enterprise Edition package.

  • Community Edition can be downloaded from Github Releases page.
  • Enterprise Edition can be downloaded from your account after you get a license on antmedia.io

2. Open the terminal and go to directory you downloaded AMS

Open a terminal and go to the directory where you have downloaded AMS zip file.

Shell
cd path/to/where/ant-media-server....zip

3. Download the installation script

Download the install_ant-media-server.sh shell script.

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

4. Run the installation script

If you are upgrading from a previous version:

You need to add "-r true" to the end of the command line if you want to keep your settings from the previous installation.

Shell
sudo ./install_ant-media-server.sh -i [ANT_MEDIA_SERVER_INSTALLATION_FILE] -r true

If you are doing a clean installation:

Shell
sudo ./install_ant-media-server.sh -i [ANT_MEDIA_SERVER_INSTALLATION_FILE]

For more command line options, type sudo ./install_ant-media-server.sh -h

5. Check if the service is running

You can check the service by using service command.

Shell
sudo service antmedia status

You can also start/stop the AMS service.

Shell
sudo service antmedia stop
sudo service antmedia start

6. Install SSL on AMS

Before this step, make sure that your server instance has a public IP address and a domain is assigned to its public IP address. Then, go to the folder where AMS is installed. Default directory is /usr/local/antmedia

Shell
cd /usr/local/antmedia

Run ./enable_ssl.sh script in the AMS installation directory. Please don't forget to replace {DOMAIN_NAME} with your domain name.

Shell
sudo ./enable_ssl.sh -d {DOMAIN_NAME}

For detailed information about SSL, follow SSL Setup.

7. Accessing the web panel

Open your browser and type http://SERVER_IP_ADDRESS:5080 to go to the web panel. If you're having difficulty accessing the web panel, there may be a firewall that blocks accessing the 5080 port.

Docker installation
Please visit for more information Docker and Docker Compose.

Cluster installation

Cluster installation is an advanced topic and it has its own page. Please visit Clustering & Scaling.

Server ports

In order to server run properly you need to open some network ports, defined below:

  • TCP: 1935 (RTMP)
  • TCP: 5080 (HTTP)
  • TCP: 5443 (HTTPS)
  • UDP: 4200 (SRT)
  • UDP: 50000-60000 (WebRTC. This default range is 50000-60000 in v2.4.3 & above. Before 2.4.3, the default value was 5000-65000. Note that you can change port range in all releases.
  • TCP: 5000 (You need to open this port in only cluster mode for the internal network communication. It should not be open to the public)

Forward default http (80), https (443) ports to 5080 and 5443

Generally, port forwarding is used to forward default ports to the server's ports for convenience. For example, let's forward all incoming data from 80 to 5080.

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

After running the command above, HTTP requests going to 80 will be forwarded to 5080. The HTTP requests going to 443 will be forwarded to 5443. 

Please pay attention that once you enable SSL, port 80 should not be used by any processes, or should not be forwarded to any other port.

Listing and deleting current port forwardings

To list port forwarding run the command below.

Shell
sudo iptables -t nat --line-numbers -L

To delete a port forwarding run the command below.

Shell
iptables -t nat -D PREROUTING [LINE_NUMBER_IN_PREVIOUS_COMMAND]

Make port forwarding persistent

If you want the server to reload port forwarding after reboot, we need to install iptables-persistent package and save rules like below.

Shell
sudo apt-get install iptables-persistent

The command above will install iptables-persistent package. After installation, run the command below every time you make a change and want it to be persistent.

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

Was this article helpful?

What's Next