If you are using a different Operating System than the machine you are deploying to, the release you are deploying will not work. But exrm lets us set a different erts directory than the one used by the system. First download the latest version of the erlang/otp distribution for the target platform from this link: https://www.erlang-solutions.com/resources/download.html Let's suppose you downloaded PACKAGE in the directory PATH:
cd <PATH>
Depending on whether you downloaded an rpm or a deb, you now need to uncompress it. For rpms, we can use:
rpm2cpio.pl <PACKAGE>.rpm | cpio -vid
for debs:
ar vx <PACKAGE>.deb && tar -xzvf data.tar.gz
at this point we will have a folder '/usr/lib/erlang' containing the correct version of the erts. We now need to tell exrm to use it in order to build our release. Back to your Phoenix project folder, create and edit the file rel/relx.config. The content should be:
{include_erts, "<PATH>/usr/lib/erlang"}.
{system_libs, "<PATH>/usr/lib/erlang/lib"}.
Run
mix release
You will not be able to execute your release locally anymore, but try deploying the .tar.gz and ta-dah! The package just works, even if you did not install any erlang virtual machine on the host!