Struggling all to install Erlang, Elixir and Phoenix on redhat linux 7

I’ve been struggling all to install Erlang, Elixir and Phoenix on redhat linux 7 but to no avail. I’ve checked elixir-lang and Erlang website but no luck. It was quite easy setting up on MacOs as brew did the job brilliantly. Is there any definitive guide to installing Erlang/Elixir and Phoenix on redhat linux 7.6(Maipo).
Currently I don’t plan running elixir in a container. Thanks.

My suggestion is to not use your OS’s package manager. I prefer to use asdf-vm. You can actually use asdf to keep version a bunch of different software for your project.

7 Likes

I’m currently working behind a proxy, I tried cloning asdf-vm from github with no success. A verbose switch on the git command would have been of help to me, is there an alternative. I’ve read a couple of resources on this forum as well but none seems to work for me.

If you want verbose output from git clone, you can add the -v switch to it.

Assuming that you want to use the RHEL as a server and not as development machine, easiest is probably to not install erlang and elixir at all, but use local CentOS or RHEL containers with a source built Erlang/elixir to build releases using either distillery or mix release.

1 Like

My dev machine is MacOs, will a release built on MacOs work for Redhat Linux or I need to build the release on using what you suggested above.

Tried -v and --verbose, it just timeout without displaying any meaningful info. Thanks.

Releases needs to be built on a system that is compatible with the target.

Usually we advise to use same distro and version to build and as target. Same patches and updates helps but is not (always) necessary.

On our production server I have both erlang and elixir manually compiled and installed. CI compiles a release via docker using the same setup as the main server. Manually compiling and installing is actually very easy once you get the base needed tools installed.

These links provide instructions on how to install Erlang and Elixir on CentOS v7. The second one assumes a virtual box. I followed these a few months ago and was successful. They should also work for RHL:

Good luck!

2 Likes

Actually, my mistake. I followed those instructions to install RH Enterprise Linux v7

[cruz@localhost ~]$ rpm --query redhat-release-server
redhat-release-server-7.6-4.el7.x86_64
[cruz@localhost ~]$ elixir --version
Erlang/OTP 21 [erts-10.1.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Elixir 1.8.0-dev (ac9e643) (compiled with Erlang/OTP 21)

So, you should be OK.

Thanks a lot, I’ve elixir installed now, will proceed to install phoenix.

1 Like

Thanks a lot, I’ve elixir installed now, will proceed to install phoenix.

I was a bit busy to expand on the above, I ran into a lot of problems installing Erlang/Elixir and Phoenix on my Redhat installation mainly due to my webproxy configuration, git clone was failing as well as https endpoints, I checked with the admin team only to be informed it was a restriction from their side. The only option I had was to setup on a local box with VirtualBox and CentOS, create my release and move it to my production machine. I’ve read and learned a lot from this forum, I’m forever indebted to this forum. Elixir has been a great experience and I’m still a newbie. Thanks everyone for the patience in guiding newbies, our questions maybe naive but you help us anyway.

2 Likes

It is a long while that I am reading about Phoenix framework, Elixir language and the wonders of the BEAM VM so three days ago I decided I read enough (almost six month reading…) and wanted to give it a try.

So far, it has been a real struggle to go beyond the installation of Erlang itself, no matter if I choose to install it on Centos 7 or Centos 8.
For Centos 7 I followed this link:
http://www.jeramysingleton.com/install-erlang-and-elixir-on-centos-7-minimal/
For Centos 8 I followed this other link:
https://computingforgeeks.com/how-to-install-latest-erlang-on-rhel-8/
In both cases I get to the point of installing Erlang correctly (I could use erl and compile the usual Hello World program).

BUT…

As soon I try to install Elixir I find myself with the same issue:

  • the installation ends with a compilation error that depending on the OS is pointing to different elements which are missing.

I am attaching the two results of both Centos 7 and Centos 8 Elixir installation hoping someone cna allow me to understand if and what I was doing wrong.

I also summarize the commands I was using to install Erlang, since I am assuming that it is where things are getting wrong maybe for some missing package:

-CENTOS7-
ERLANG
yum install epel-release
yum -y update && yum -y upgrade
yum install gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git
yum install wxBase.x86_64
wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
yum install esl-erlang

-CENTOS8-
ERLANG
export VER=“22.1.6”
wget https://github.com/rabbitmq/erlang-rpm/releases/download/v${VER}/erlang-${VER}-1.el8.x86_64.rpm
yum localinstall erlang-${VER}-1.el8.x86_64.rpm
nano ~/.bashrc
export PATH="$PATH:/usr/lib64/erlang/bin/"

-BOTH OS-
ELIXIR
cd /opt
yum install git
git clone https://github.com/elixir-lang/elixir.git
cd elixir/
make clean test

On CENTOS 7 this is the make log:

sudo make clean test

rm -rf ebin
rm -rf lib/*/ebin
rm -rf lib/elixir/src/elixir_parser.erl
make[1]: Entering directory /opt/elixir' rm -rf lib/*/_build/ rm -rf lib/*/tmp/ rm -rf lib/elixir/test/ebin/ rm -rf lib/mix/test/fixtures/deps_on_git_repo/ rm -rf lib/mix/test/fixtures/git_rebar/ rm -rf lib/mix/test/fixtures/git_repo/ rm -rf lib/mix/test/fixtures/git_sparse_repo/ rm -f erl_crash.dump make[2]: Entering directory /opt/elixir’
rm -f man/elixir.1
rm -f man/elixir.1.bak
rm -f man/iex.1
rm -f man/iex.1.bak
make[2]: Leaving directory /opt/elixir' make[1]: Leaving directory /opt/elixir’
Recompile: src/elixir_utils
Recompile: src/elixir_tokenizer
Recompile: src/elixir_sup
Recompile: src/elixir_rewrite
Recompile: src/elixir_quote
Recompile: src/elixir_parser
Recompile: src/elixir_overridable
Recompile: src/elixir_module
Recompile: src/elixir_map
Recompile: src/elixir_locals
Recompile: src/elixir_lexical
Recompile: src/elixir_interpolation
Recompile: src/elixir_import
Recompile: src/elixir_fn
Recompile: src/elixir_expand
Recompile: src/elixir_errors
Recompile: src/elixir_erl_var
Recompile: src/elixir_erl_try
Recompile: src/elixir_erl_pass
Recompile: src/elixir_erl_for
Recompile: src/elixir_erl_compiler
Recompile: src/elixir_erl_clauses
Recompile: src/elixir_erl
Recompile: src/elixir_env
Recompile: src/elixir_dispatch
Recompile: src/elixir_def
Recompile: src/elixir_config
Recompile: src/elixir_compiler
Recompile: src/elixir_code_server
Recompile: src/elixir_clauses
Recompile: src/elixir_bootstrap
Recompile: src/elixir_bitstring
Recompile: src/elixir_aliases
Recompile: src/elixir
Generated elixir.app
==> bootstrap (compile)
Compiled lib/elixir/lib/kernel.ex
Compiled lib/elixir/lib/macro/env.ex
Compiled lib/elixir/lib/keyword.ex
Compiled lib/elixir/lib/module.ex
Compiled lib/elixir/lib/list.ex
Compiled lib/elixir/lib/macro.ex
Compiled lib/elixir/lib/kernel/typespec.ex
Compiled lib/elixir/lib/code.ex
Compiled lib/elixir/lib/code/identifier.ex
Compiled lib/elixir/lib/module/checker.ex
Compiled lib/elixir/lib/module/locals_tracker.ex
Compiled lib/elixir/lib/module/parallel_checker.ex
Compiled lib/elixir/lib/module/types/helpers.ex
Compiled lib/elixir/lib/module/types/infer.ex
Compiled lib/elixir/lib/module/types.ex
Compiled lib/elixir/lib/kernel/utils.ex
Compiled lib/elixir/lib/exception.ex
Compiled lib/elixir/lib/protocol.ex
Compiled lib/elixir/lib/stream/reducers.ex
Compiled lib/elixir/lib/enum.ex
Compiled lib/elixir/lib/map.ex
Compiled lib/elixir/lib/inspect/algebra.ex
Compiled lib/elixir/lib/inspect.ex
Compiled lib/elixir/lib/access.ex
Compiled lib/elixir/lib/range.ex
Compiled lib/elixir/lib/regex.ex
Compiled lib/elixir/lib/string.ex
Compiled lib/elixir/lib/string/chars.ex
Compiled lib/elixir/lib/io.ex
Compiled lib/elixir/lib/path.ex
Compiled lib/elixir/lib/file.ex
Compiled lib/elixir/lib/system.ex
Compiled lib/elixir/lib/kernel/cli.ex
Compiled lib/elixir/lib/kernel/error_handler.ex
Compiled lib/elixir/lib/kernel/parallel_compiler.ex
Compiled lib/elixir/lib/kernel/lexical_tracker.ex
make[1]: Entering directory /opt/elixir' ==> unicode (compile) Compiling /opt/elixir/lib/elixir/unicode/unicode.ex (it's taking more than 15s) make[1]: Leaving directory /opt/elixir’
==> elixir (compile)
make[1]: Entering directory /opt/elixir' Generated elixir.app make[1]: Leaving directory /opt/elixir’
==> eex (compile)
==> mix (compile)
Generated mix app
==> ex_unit (compile)
Generated ex_unit app
==> logger (compile)
Generated logger app
Generated eex app
==> iex (compile)
Generated iex app
==> elixir (eunit)
All 190 tests passed.

==> elixir (ex_unit)
Excluding tags: [windows: true]

Finished in 59.9 seconds (36.4s on load, 23.4s on tests)
1553 doctests, 3362 tests, 0 failures, 7 excluded

Randomized with seed 628893
==> ex_unit (ex_unit)

Finished in 6.0 seconds (3.4s on load, 2.5s on tests)
41 doctests, 307 tests, 0 failures

Randomized with seed 960549
==> logger (ex_unit)

Finished in 2.3 seconds (1.9s on load, 0.4s on tests)
3 doctests, 121 tests, 0 failures

Randomized with seed 801872
==> mix (ex_unit)
Excluding tags: [windows: true]

…–rpc-eval : RPC failed with reason :nodedown

  1. test executes rpc instructions (Mix.Tasks.ReleaseTest)
    test/mix/tasks/release_test.exs:320
    Assertion with == failed
    code: assert System.cmd(script, [“rpc”, “ReleaseTest.hello_world()”]) == {“hello world\n”, 0}
    left: {"", 1}
    right: {“hello world\n”, 0}
    stacktrace:
    test/mix/tasks/release_test.exs:331: anonymous fn/1 in Mix.Tasks.ReleaseTest.“test executes rpc instructions”/1
    (mix 1.10.0-dev) lib/mix/project.ex:352: Mix.Project.in_project/4
    (elixir 1.10.0-dev) lib/file.ex:1544: File.cd!/2
    test/test_helper.exs:120: MixTest.Case.in_fixture/3
    test/mix/tasks/release_test.exs:321: (test)

…–rpc-eval : RPC failed with reason :nodedown

  1. test runs in daemon mode (Mix.Tasks.ReleaseTest)
    test/mix/tasks/release_test.exs:386
    Assertion with == failed
    code: assert System.cmd(script, [“rpc”, “ReleaseTest.hello_world()”]) == {“hello world\n”, 0}
    left: {"", 1}
    right: {“hello world\n”, 0}
    stacktrace:
    test/mix/tasks/release_test.exs:424: anonymous fn/1 in Mix.Tasks.ReleaseTest.“test runs in daemon mode”/1
    (mix 1.10.0-dev) lib/mix/project.ex:352: Mix.Project.in_project/4
    (elixir 1.10.0-dev) lib/file.ex:1544: File.cd!/2
    test/test_helper.exs:120: MixTest.Case.in_fixture/3
    test/mix/tasks/release_test.exs:387: (test)

Finished in 143.5 seconds (8.3s on load, 135.2s on tests)
9 doctests, 604 tests, 2 failures

Randomized with seed 73370
make: *** [test_mix] Error 1

ON CENTOS 8

make clean test

rm -rf ebin
rm -rf lib//ebin
rm -rf lib/elixir/src/elixir_parser.erl
make[1]: Entering directory ‘/opt/elixir’
rm -rf lib/
/_build/
rm -rf lib/*/tmp/
rm -rf lib/elixir/test/ebin/
rm -rf lib/mix/test/fixtures/deps_on_git_repo/
rm -rf lib/mix/test/fixtures/git_rebar/
rm -rf lib/mix/test/fixtures/git_repo/
rm -rf lib/mix/test/fixtures/git_sparse_repo/
rm -f erl_crash.dump
make[2]: Entering directory ‘/opt/elixir’
rm -f man/elixir.1
rm -f man/elixir.1.bak
rm -f man/iex.1
rm -f man/iex.1.bak
make[2]: Leaving directory ‘/opt/elixir’
make[1]: Leaving directory ‘/opt/elixir’
Recompile: src/elixir_utils
Recompile: src/elixir_tokenizer
Recompile: src/elixir_sup
Recompile: src/elixir_rewrite
Recompile: src/elixir_quote
Recompile: src/elixir_parser
Recompile: src/elixir_overridable
Recompile: src/elixir_module
Recompile: src/elixir_map
Recompile: src/elixir_locals
Recompile: src/elixir_lexical
Recompile: src/elixir_interpolation
Recompile: src/elixir_import
Recompile: src/elixir_fn
Recompile: src/elixir_expand
Recompile: src/elixir_errors
Recompile: src/elixir_erl_var
Recompile: src/elixir_erl_try
Recompile: src/elixir_erl_pass
Recompile: src/elixir_erl_for
Recompile: src/elixir_erl_compiler
Recompile: src/elixir_erl_clauses
Recompile: src/elixir_erl
Recompile: src/elixir_env
Recompile: src/elixir_dispatch
Recompile: src/elixir_def
Recompile: src/elixir_config
Recompile: src/elixir_compiler
Recompile: src/elixir_code_server
Recompile: src/elixir_clauses
Recompile: src/elixir_bootstrap
Recompile: src/elixir_bitstring
Recompile: src/elixir_aliases
Recompile: src/elixir
Generated elixir.app
==> bootstrap (compile)
Compiled lib/elixir/lib/kernel.ex
Compiled lib/elixir/lib/macro/env.ex
Compiled lib/elixir/lib/keyword.ex
Compiled lib/elixir/lib/module.ex
Compiled lib/elixir/lib/list.ex
Compiled lib/elixir/lib/macro.ex
Compiled lib/elixir/lib/kernel/typespec.ex
Compiled lib/elixir/lib/code.ex
Compiled lib/elixir/lib/code/identifier.ex
Compiled lib/elixir/lib/module/checker.ex
Compiled lib/elixir/lib/module/locals_tracker.ex
Compiled lib/elixir/lib/module/parallel_checker.ex
Compiled lib/elixir/lib/module/types/helpers.ex
Compiled lib/elixir/lib/module/types/infer.ex
Compiled lib/elixir/lib/module/types.ex
Compiled lib/elixir/lib/kernel/utils.ex
Compiled lib/elixir/lib/exception.ex
Compiled lib/elixir/lib/protocol.ex
Compiled lib/elixir/lib/stream/reducers.ex
Compiled lib/elixir/lib/enum.ex
Compiled lib/elixir/lib/map.ex
Compiled lib/elixir/lib/inspect/algebra.ex
Compiled lib/elixir/lib/inspect.ex
Compiled lib/elixir/lib/access.ex
Compiled lib/elixir/lib/range.ex
Compiled lib/elixir/lib/regex.ex
Compiled lib/elixir/lib/string.ex
Compiled lib/elixir/lib/string/chars.ex
Compiled lib/elixir/lib/io.ex
Compiled lib/elixir/lib/path.ex
Compiled lib/elixir/lib/file.ex
Compiled lib/elixir/lib/system.ex
Compiled lib/elixir/lib/kernel/cli.ex
Compiled lib/elixir/lib/kernel/error_handler.ex
Compiled lib/elixir/lib/kernel/parallel_compiler.ex
Compiled lib/elixir/lib/kernel/lexical_tracker.ex
make[1]: Entering directory ‘/opt/elixir’
==> unicode (compile)
Compiling /opt/elixir/lib/elixir/unicode/unicode.ex (it’s taking more than 15s)
make[1]: Leaving directory ‘/opt/elixir’
==> elixir (compile)
make[1]: Entering directory ‘/opt/elixir’
Generated elixir.app
make[1]: Leaving directory ‘/opt/elixir’
==> eex (compile)
==> mix (compile)
Generated mix app
==> ex_unit (compile)
Generated ex_unit app
==> logger (compile)
Generated logger app
Generated eex app
==> iex (compile)
Generated iex app
==> elixir (eunit)
All 190 tests passed.

==> elixir (ex_unit)
warning: :dialyzer.format_warning/1 is undefined (module :dialyzer is not available or is yet to be defined)
test/elixir/kernel/dialyzer_test.exs:165: Kernel.DialyzerTest.assert_dialyze_no_warnings!/1

warning: :dialyzer.run/1 is undefined (module :dialyzer is not available or is yet to be defined)
test/elixir/kernel/dialyzer_test.exs:172: Kernel.DialyzerTest.dialyzer_run/1

Excluding tags: [windows: true]

…???.

  1. Kernel.DialyzerTest: failure on setup_all callback, all tests have been invalidated
    ** (UndefinedFunctionError) function :dialyzer.run/1 is undefined (module :dialyzer is not available)
    stacktrace:
    :dialyzer.run([analysis_type: :plt_build, output_plt: ‘/opt/elixir/lib/elixir/tmp/dialyzer/base_plt’, apps: [:erts], files: [’/opt/elixir/bin/…/lib/elixir/ebin/elixir.beam’, ‘/opt/elixir/bin/…/lib/elixir/ebin/elixir_env.beam’, ‘/opt/elixir/bin/…/lib/elixir/ebin/Elixir.Atom.beam’, ‘/opt/elixir/bin/…/lib/elixir/ebin/Elixir.Enum.beam’, ‘/opt/elixir/bin/…/lib/elixir/ebin/Elixir.Exception.beam’, ‘/opt/elixir/bin/…/lib/elixir/ebin/Elixir.Kernel.beam’, ‘/opt/elixir/bin/…/lib/elixir/ebin/Elixir.Macro.beam’, ‘/opt/elixir/bin/…/lib/elixir/ebin/Elixir.Macro.Env.beam’, ‘/opt/elixir/bin/…/lib/elixir/ebin/Elixir.String.beam’]])
    test/elixir/kernel/dialyzer_test.exs:172: Kernel.DialyzerTest.dialyzer_run/1
    test/elixir/kernel/dialyzer_test.exs:27: Kernel.DialyzerTest.__ex_unit_setup_all_0/1
    test/elixir/kernel/dialyzer_test.exs:3: Kernel.DialyzerTest.ex_unit/2

Finished in 50.7 seconds (35.8s on load, 14.9s on tests)
1553 doctests, 3362 tests, 0 failures, 7 excluded, 15 invalid

Randomized with seed 333588
make: *** [Makefile:272: test_stdlib] Error 1

Compilation seems to be a success, have you tried actually installing it despite the failing tests?

Yes I did, but iex not always works and Phoneix cannot be installed

Am I too picky since I was expecting no errors during compilation?

What does “not always works” mean, and also what is the error you see when installing phoenix?

There have been no errors during compilation, the errors where solely failing tests.

This can happen, especially when one tries to build master. Please checkout a versions tag or support branch explicitely before running tests.

Also, usually you do not need to run the test suite unless you want to contribute to the source code, and then its just that you do not make any tests fail that haven’t failed before you touched anything…

In centos 8 I cannot even start iex have a list or errors while on Centos 7 I can but sometimes it breaks.

I am going to try again from scratch, it will take me less than 1 hour and I can get back here witht he results

I started from scratch…

CENTOS 8

yum -y update && yum -y upgrade
reboot -f

systemctl stop firewalld
systemctl disable firewalld

yum install nano wget
yum install gcc gcc-c++ glibc-devel make automake ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git

nano /etc/profile.d/custom.sh
    export EDITOR="nano"
    export VISUAL="nano"
    PS1='\[\e[0;35m\][\u@\H]\n[\w]\n\$\[\e[0m\] '

nano /etc/selinux/config
    SELINUX=disabled

reboot -f

ERLANG

https://computingforgeeks.com/how-to-install-latest-erlang-on-rhel-8/
https://github.com/rabbitmq/erlang-rpm/releases
export VER="22.1.6"
wget https://github.com/rabbitmq/erlang-rpm/releases/download/v${VER}/erlang-${VER}-1.el8.x86_64.rpm
yum localinstall erlang-${VER}-1.el8.x86_64.rpm

ELIXIR

mkdir /opt/elixir
git clone https://github.com/elixir-lang/elixir.git /opt/elixir
    Cloning into '/opt/elixir'...
    remote: Enumerating objects: 64, done.
    remote: Counting objects: 100% (64/64), done.
    remote: Compressing objects: 100% (60/60), done.
    remote: Total 146303 (delta 4), reused 15 (delta 3), pack-reused 146239
    Receiving objects: 100% (146303/146303), 40.86 MiB | 889.00 KiB/s, done.
    Resolving deltas: 100% (94360/94360), done.

cd /opt/elixir

make clean test

nano ~/.bashrc
    export PATH="$PATH:/opt/elixir/bin"

Now at least both seem to be ok, the only difference I was adding “automake” among the packages I installed (not sure it was a real difference or because I started from scratch!)

[~]
# erl
Erlang/OTP 22 [erts-10.5.4] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]
Eshell V10.5.4  (abort with ^G)
1>

[~]
# iex
Erlang/OTP 22 [erts-10.5.4] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]
Interactive Elixir (1.10.0-dev) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>