DEV Community

Cover image for Installing Elixir on Debian Crostini
cyril
cyril

Posted on

Installing Elixir on Debian Crostini

Introduction

The official Elixir installation script does not support Debian, a flavor of the Linux operating system, that is widely used, specifically in servers, development environments, and Chromebooks.

In this post, we shall find a workaround and install Elixir on Debian Crostini, a customized version of Debian that comes with ChromeOs which powers Chromebooks worldwide.

Elixir is a modern functional programming language that runs on ErlangVM. It is known for having an easy-to-write syntax, high scalability, and designed to be fault tolerant and scalable. In recent times, Elixir has become the language of choice for managing the systems and logic around AI agents and chatbots due to its concurrency, distributed computing, and real-time capabilities.

In the next section, we'll cover the overview of the steps required to install Elixir on Debian systems.

Overview of Steps

The following steps are required to install Elixir on Debian:

  • Install asdf
  • Install Erlang
  • Install Elixir

Installing ASDF

asdf is a tool version manager that ensures consistency in the version of tools across users by providing a single interface and configuration file to make development workflows simple.

To install asdf, we first need to install dependencies.

$ sudo apt install -y curl git
Enter fullscreen mode Exit fullscreen mode

Next, clone asdf from the GitHub repo:

$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.16.4
Enter fullscreen mode Exit fullscreen mode

Replace v0.16.4 with the version of ASDF you wish to install.

Now let's add the binaries to .bashrc environment.

$ subl ~/.bashrc 
Enter fullscreen mode Exit fullscreen mode

Here, you can use any text editor of your choice. This example uses the Sublime Text (subl) editor.

Then add the following lines at the end of the file:

. "$HOME/.asdf/asdf.sh"
. "$HOME/.asdf/completions/asdf.bash"
Enter fullscreen mode Exit fullscreen mode

Now we can fetch the version for asdf to verify a successful install:

$ asdf --version
v0.15.0-4b9297b
Enter fullscreen mode Exit fullscreen mode

With asdf installed, we can now proceed to install Erlang.

Installing Erlang

Let's install dependencies before compiling Erlang with asdf.

$ sudo apt install -y build-essential autoconf automake m4 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
Enter fullscreen mode Exit fullscreen mode

We can then proceed to install Erlang:

$ asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git
$ asdf install erlang 27.2.4
$ asdf global erlang 27.2.4
Enter fullscreen mode Exit fullscreen mode

Where 27.2.4 is the version of Erlang you wish to install.

With Erlang installed, we can proceed to finish with adding Elixir.

Installing Elixir

Let's add elixir as a plugin and then execute the install command.

$ asdf plugin add elixir https://github.com/asdf-vm/asdf-elixir.git
$ asdf install elixir 1.18.2-otp-27
$ asdf global elixir 1.18.2-otp-27
Enter fullscreen mode Exit fullscreen mode

Where 1.18.2 is the version of elixir, and 27 is the version of Erlang installed beforehand.

By checking the elixir version, you should see something similar to the following:

$ elixr -v
Elixir 1.18.2 (compiled with Erlang/OTP 27)
Enter fullscreen mode Exit fullscreen mode

Elixir is now successfully installed. You can now launch the interactive console by executing the following command:

$ iex
Enter fullscreen mode Exit fullscreen mode

Conclusion

In this post, we successfully navigated the challenge of installing Elixir on Debian Crostini, a customized version of Debian used in Chromebooks. By leveraging asdf, a versatile tool version manager, we installed both Erlang and Elixir, ensuring compatibility and consistency. This setup unlocks the power of Elixir’s concurrency, fault tolerance, and real-time capabilities, making it a great choice for building scalable systems, AI agents, and chatbots.

Top comments (0)