How To Install Erlang on Debian 11

In this tutorial, you will learn to Install Erlang on Debian 11.

The Erlang programming language is a general-purpose, simultaneous and garbage-collected programming language, which also serves as a runtime system. The sequential derivative of Erlang is a functional language with firm calculation, single assignment, and dynamic data entry, which concurrently follows the Actor model.

Steps To Install Erlang on Debian 11

To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Debian 11.

Installing Erlang Programming Language on Debian 11

First of all, you need to install some required packages on your server with the following command:

sudo apt install dirmngr ca-certificates software-properties-common gnupg gnupg2 apt-transport-https curl -y

Then, use the folloiwng comand to import the Erlang GPG key:

curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/erlang.gpg

Next, import the Erlang repository to your server by using the command below:

echo "deb [signed-by=/usr/share/keyrings/erlang.gpg] bullseye contrib" | sudo tee /etc/apt/sources.list.d/erlang.list

Update your local package index with the command below:

sudo apt update

Finally, use the following comamnd to install Erlang:

sudo apt install erlang -y

Now you can easily launch your Erlang shell on Debian 11 with the following command:

Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit:ns]

Eshell V13.0.4  (abort with ^G)

Here are some comon useful commands that you can use:

q(). Quits the shell and the Erlang runtime
c(file). Compiles the specified Erlang file
b(). Displays all variable bindings
f(). Clears all variable bindings
f(X). Clears specified variable binding
h(). Prints the history list of commands
e(N). Repeats the command on line N
v(N). The return value of line N
catch_exception(boolean). Sets how strict the shell will be in passing errors
rd(Name,Definition). Defines a record type Name with contents specified by Definition
rr(File). Defines record types based on the contents of File
rf(). Clears all record definitions. Can also clear specific definitions
rl(). Lists all current record definitions
pwd(). Gets the present working directory
ls(). Lists files at the current location
cd(Directory). Changes to the specified Directory

Build a Test Program with Erlang

At this point, you can test your Erlang installation on Debian 11 by creating a simple hello world program.

First, create a file with your favorite text editor, here we use vi:

sudo vi helloworld.erl

Add the following script to the file:

-module(helloworld).  % The name of our module.

-export([helloworld/0]).  % Declaration of the function that we want to export from the module.

helloworld() -> io:format("Hello World!! Thanks ~n").  % What is to happen when the function is called, here: Hello world is to be written on the screen.

When you are done, save and close the file.

Then, open your Erlang shell:


Compile the file program Hello World test you just created using the following command:

Eshell V13.0.4  (abort with ^G)
1> c(helloworld).

Next, compile the program:

2> helloworld:helloworld().
Hello World!! Thanks

To exit from your Erl shell, run the command below:


For more information, you can visit the Erlang Documentation page.

Remove Erlang Programming Language

If you no longer want to use Erlang on Debian 11, first, remove the software using the following command:

sudo apt autoremove erlang --purge -y

You should remove the APT repository from your sources list for complete removal:

sudo rm /etc/apt/sources.list.d/erlang.list

Also, you can remove the GPG key:

sudo rm /usr/share/keyrings/erlang.gpg


At this point, you have learned to Install Erlang on Debian 11 and create a sample project.

Hope you enjoy it.

You may be like these articles:

Reset Root Password on Debian 11

How To Enable BBR on Debian 11

Upgrade Debian 10 to Debian 11

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!