Author's Avatar


Setup a Elixir Development Environment on local nachine

We will start updating the apt repository and installing all packages of distro

sudo apt update && sudo apt upgrade -y

After that we will set the environment variable WSL_HOST to be able to access webservers inside the wsl container

export WSL_HOST=$(tail -1 /etc/resolv.conf | cut -d' ' -f2) >> .bashrc

Installing ASDF

Install asdf dependencies

apt install curl git

Setup auto complete

echo -e '\n. $HOME/.asdf/' >> ~/.bashrc
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
source ~/.bashrc

Check if asdf is correctly installed running the command:


Installing Erlang

Install erlang dependencies:

apt-get -y install build-essential autoconf m4 libncurses5-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop
asdf plugin add erlang
rodrigo@DESKTOP-RB4M1AC:~$ asdf list erlang
asdf global erlang 24.3.4

Install Elixir

asdf plugin-add elixir
asdf install elixir latest

Creating a new app

mix new reddit --sup --app reddit

The files/directories we'll be focusing on in this tutorial are:

lib/ - Where our application code will live lib/reddit/application.ex - Where we'll describe how the application should be started and how it should be supervised mix.exs - Where we'll describe the configuration of our application and it's dependencies. Now that Mix has scaffolded up our project, let's add the dependencies we need to set up our server.