Skip to content

Instantly share code, notes, and snippets.

@clsource
Last active November 28, 2023 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clsource/9a7e554f7c9da409a60154b676f2c198 to your computer and use it in GitHub Desktop.
Save clsource/9a7e554f7c9da409a60154b676f2c198 to your computer and use it in GitHub Desktop.
Install Elixir in Debian 12

Hello! I am Camilo from Chile 🇨🇱. I am using a translator. I hope this information is useful.

In this article we will see how to install Elixir in Debian 12 using asdf vm.

Why Debian 12?

Debian (GNU/Linux in general) allow us to use really old hardware. I managed to revive an old Dell Latitude e430 (from 2007) and use the latest version of Erlang, Elixir and Firefox in it.

It's magical to use old machines and give them a new life, reducing the electronic waste and helping the planet.

Installing Debian

Installing Debian is out of scope for this tutorial. But my recommendation is using an USB drive and install it with ext4 filesystem and xfce4 desktop environment.

You can download it from the official Debian Website and write it using Balena Etcher or similar tool.

What is asdf?

asdf is a tool version manager. All tool version definitions are contained within one file (.tool-versions) which you can check in to your project's Git repository to share with your team. asdf ensures teams are using the exact same versions of tools, with support for many tools via a plugin system, and the simplicity and familiarity of being a single Shell script you include in your Shell config.

Installing asdf

We will follow the Getting Started Guide.

First we need to install the dependencies for asdf.

$ sudo apt install -y curl git

Now we install asdf

$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.13.1

And add the binaries to .bashrc environment. Please Check the guide for other environments beside bash.

you can use vim, nano, emacs or your favorite editor.

$ vim ~/.bashrc

Add the following lines at the end of the file

. "$HOME/.asdf/asdf.sh"
. "$HOME/.asdf/completions/asdf.bash"

Now we can use

$ source ~/.bashrc

to reload our environment and we can fetch the version for asdf

$ asdf --version
v0.13.1

Install Erlang and Elixir

Some dependencies must be installed before compiling Erlang with asdf.

sudo apt install -y build-essential autoconf automake m4 libcurses5-dev libwxgtk3.2-dev libwxgtk-webview3.2-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils libncurses-dev openjdk-17-jdk

When the dependencies are installed we can procede to install erlang.

$ asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git
$ asdf install erlang 25.3.2.7
$ asdf global erlang 25.3.2.7

and elixir

$ asdf plugin add elixir https://github.com/asdf-vm/asdf-elixir.git
$ asdf install elixir 1.15.7-otp-25
$ asdf global elixir 1.15.7-otp-25

Now we can use our beloved elixir

$ elixir -v
Elixir 1.15.7 (compiled with Erlang/OTP 25)

Next Steps

Now you have all the required tools to program with Elixir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment