DEV Community

Cover image for Complete Guide: Installing Elixir on Fedora/Linux 40
João Paulo Abreu
João Paulo Abreu

Posted on • Updated on

Complete Guide: Installing Elixir on Fedora/Linux 40

Introduction

In this guide, we will learn how to install Elixir on Fedora/Linux version 40. Elixir is a functional and concurrent programming language, ideal for developing distributed applications.

I am currently using Fedora/Linux version 40 with a window manager called DWM, which is a Tiling Window Manager that allows you to open windows within predefined layouts and has several workspaces called tags.

There are two main methods to install Elixir on Fedora: using the dnf package manager or using asdf, a version manager. I personally use asdf, but I will show both methods so you can choose the one that best suits your needs.

Method 1: Installing Elixir with dnf

To install Elixir using Fedora's package manager called dnf, you can type the following command in the terminal:

Method 1: Installing Elixir with dnf

To install Elixir using Fedora's package manager called dnf, you can type the following command in the terminal:

sudo dnf install elixir erlang erlang-doc
Enter fullscreen mode Exit fullscreen mode
  • elixir: This package installs the Elixir compiler and the basic tools needed to develop with Elixir.
  • erlang: This package installs the Erlang virtual machine (BEAM) and the necessary components to run Elixir applications.
  • erlang-doc: This package contains the Erlang documentation, which can be useful for reference during development.

Using VS Code with Elixir

As a code editor, you can use VS Code with the ElixirLS extension, which is a language server that provides autocompletion and other features. You can find it on the Visual Studio Code Marketplace.

Method 2: Installing asdf on Fedora

In my specific case, I use asdf, which is a version manager, making it easier to have multiple versions of Elixir and Erlang installed on my machine and switch between them for each project.

You can find more information about asdf at the following address: asdf-vm.com. One of the advantages of asdf is that you can have a single installation manager supporting multiple languages.

Installing asdf on Fedora

Step 1: Install Dependencies

First, install two dependencies:

sudo dnf install curl git
Enter fullscreen mode Exit fullscreen mode

Step 2: Clone the asdf Repository

Next, run the following git command in your terminal to install asdf:

Step 3: Configure Zsh

For those using Zsh as a shell, the following configuration must be done in the .zshrc file by adding the line below:

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

Step 4: Install Additional Dependencies

Now, to install asdf plugins for each language on Fedora, you need to install some dependencies:

sudo dnf install gnupg2 curl gawk
Enter fullscreen mode Exit fullscreen mode

Plugins I Use with asdf:

Node.js

To add the Node.js plugin:

asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
Enter fullscreen mode Exit fullscreen mode

To list available versions for installation:

asdf list-all nodejs
Enter fullscreen mode Exit fullscreen mode

Installing a specific version:

asdf install nodejs 20.14.0
Enter fullscreen mode Exit fullscreen mode

Setting the global version:

asdf global nodejs 20.14.0
Enter fullscreen mode Exit fullscreen mode

Erlang

Erlang is necessary to have the virtual machine where Elixir will run.

To add the Erlang plugin:

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

Install dependencies for Fedora (link for more information):

sudo dnf groupinstall -y 'Development Tools' 'C Development Tools and Libraries'
sudo dnf install -y autoconf ncurses-devel openssl-devel libxslt fop
Enter fullscreen mode Exit fullscreen mode

Installing a specific version:

asdf install erlang 27.0
Enter fullscreen mode Exit fullscreen mode

Setting the global version:

asdf global erlang 27.0
Enter fullscreen mode Exit fullscreen mode

Elixir

To add the Elixir plugin:

asdf plugin add elixir https://github.com/asdf-vm/asdf-elixir.git
Enter fullscreen mode Exit fullscreen mode

Installing a specific version:

asdf install elixir 1.17
Enter fullscreen mode Exit fullscreen mode

Setting the global version:

asdf global elixir 1.17
Enter fullscreen mode Exit fullscreen mode

Verifying Installations

Now you can open a new terminal and run the following commands to check if they are installed correctly:

node --version
elixir --version
Enter fullscreen mode Exit fullscreen mode

Now you are ready to start your journey into the world of Elixir! With all the necessary tools installed, you can explore the powerful features of this amazing language. Don't hesitate to experiment, explore, and create amazing projects. Good luck and have fun learning Elixir!

Top comments (0)