Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.
The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows
the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir
and you are good to go.
Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to
a specific version, you will need to compile it yourself. Then kerl
and exenv
are your best friends.
These packages are only needed if you intend to compile erlang yourself, or to work with several versions at a time.
If you just need some erlang/elixir installation, you can do it with your regular package manager. It will depend on your distribution that you have a version of erlang that is recent enough. For instance, on Fedora you will probably have the last version released, but on Ubuntu you may have an older one.
# install system build packages
sudo dnf install make automake gcc gcc-c++ kernel-devel git wget openssl-devel ncurses-devel wxBase3 wxGTK3-devel m4
# make wxWidgets3 visible to erlang (to build Erlang Observer)
mkdir -p ~/.local/bin
cd ~/.local/bin
ln -s /usr/bin/wx-config-3.0 wx-config
ln -s /usr/bin/wxrc-3.0 wxrc
sudo apt-get install build-essential git wget libssl-dev libreadline-dev libncurses5-dev zlib1g-dev m4 curl wx-common libwxgtk3.0-dev autoconf
asdf
lives in https://github.com/asdf-vm/asdf
Follow its installation instructions, which at the moment of writing were:
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.1.0
# For Ubuntu or other linux distros
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
Install Erlang and Elixir plugins:
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
On a new terminal:
asdf install erlang 19.0
asdf install elixir 1.3.2
Then set them as the global version:
asdf global erlang 19.0
asdf global elixir 1.3.2
Create a .tool-versions in your $HOME/user dir with versions you want to use
erlang x.y.z
nodejs x.y.z
elixir x.y.z
ruby x.y.z
Now you can open a new terminal and try erl
:
$ erl
Erlang/OTP 19 [erts-8.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V8.0 (abort with ^G)
1>
Or start Erlang Observer by erl -s observer start
.
And you can try 'iex':
$ iex
Erlang/OTP 19 [erts-8.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Interactive Elixir (1.3.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
Use asdf
.tool-versions
file to manage which version is active on each of your projects.
Enjoy!