SSL errors with Elixir on Ubuntu

The Elixir language website has instructions on how to install Elixir on Ubuntu, however following those steps may lead to future errors when trying to install some Erlang libraries.

Running the command sudo apt-get install elixir will install Erlang and then Elixir, but on a fresh copy of Ubuntu the version of Erlang it installs will not have SSL support so when you later try to install libraries like hackney and Hex it will throw errors:

1
2
3
4
5
6
7
8
9
10
Could not start Hex. Try fetching a new version with `mix local.hex` or uninstalling it with `mix archive.uninstall hex.ez`
** (UndefinedFunctionError) undefined function: :ssl.start/0 (module :ssl is not available)
:ssl.start()
lib/hex.ex:17: Hex.start_api/0
lib/hex.ex:9: Hex.start/0
(mix) lib/mix/tasks/local.hex.ex:69: Mix.Tasks.Local.Hex.start/0
(mix) lib/mix/dep/loader.ex:117: Mix.Dep.Loader.with_scm_and_app/1
(mix) lib/mix/dep/loader.ex:86: Mix.Dep.Loader.to_dep/3
(elixir) lib/enum.ex:977: Enum."-map/2-lc$^0/1-0-"/2
(mix) lib/mix/dep/loader.ex:234: Mix.Dep.Loader.mix_children/1

To have a version of Erlang with SSL support you need to make sure the libssl-dev Ubuntu package has been installed before this step.