How to Install Erlang on Debian 11 Bullseye

Erlang is a functional, concurrent programming language designed specifically for systems with high availability requirements. The original implementation was developed by Ericsson in the 1980s and was later released as open source in 1998. Over the years, Erlang has gained a reputation for being particularly well suited for parallel and distributed systems. This is due to its support for “lightweight” processes, which can be created and destroyed very efficiently. In addition, Erlang’s fault-tolerant design also means that it can gracefully handle failures without bringing down the entire system. As a result, Erlang has become a popular choice for mission-critical applications that require high availability.

In the following tutorial, you will learn how to install ErLang on Debian 11 Bullseye desktop or headless server with the official APT repository using the command line terminal and instructions on how to update and remove the software in the future if required.

Update Debian

First, update your system to ensure all existing packages are up to date to avoid conflicts.

sudo apt update && sudo apt upgrade

Install Erlang

The best method to install Erlang is to install it from the official Erlang APT repository.

First, install the required packages.

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

Next, import the GPG key required to verify the authenticity of the packages as follows.

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

Now import the APT repository using the following command.

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

Run a quick APT update to reflect the newly added APT source.

sudo apt update

Lastly, install Erlang using the following command.

sudo apt install erlang -y

How to Launch Erlang Shell

With Erlang installed, to launch the shell environment, use the following command.


Here are some useful commands you may frequently use in the terminal.

  • 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
See also
How to Install MariaDB 10.x on Debian 11 or 10

Create Hello World Test with Erlang

As an optional extra, you can create the famous Hello World output to test your Erlang installation.

First, create a file using any text editor; the tutorial will use nano.

nano helloworld.erl

Next, copy and paste the below into 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.

Save the file if you are using nano as per the tutorial, CTRL+O and then ENTER KEY, then CTRL+X to exit the file.

Now, open the erl shell.


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


Once done, run the compiled program as follows.


Example output:

Exit the shell, and type the following command.


How to Update/Upgrade Erlang

Next are the commands to run in your terminal to check for updates. These commands will blanket check all installed packages on your system that match the installation package manager. Ideally, you should run this regardless, even if auto-updates are set up to ensure your system is up-to-date and no update errors occur for newer users.

sudo apt update && sudo apt upgrade

How to Remove (Uninstall) Erlang

First, remove the software using the following command for users that no longer wish to have Erlang installed.

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

Optionally, you can remove the GPG as well with the following command.

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

Comments and Conclusion

If you’re looking for a language that can handle high-availability systems with ease, Erlang is worth considering. It’s been designed specifically for this purpose and has a proven track record of success. In addition, the fact that it’s open source means that you can take advantage of its features without spending a penny.

For further information, visit the Erlang documentation.

Leave a Comment

Share to...