Share your love
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, concurrent, 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.
You can now proceed to the guide steps below on the Orcacore website to set up Erlang on Debian 11.
Table of Contents
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 on the Initial Server Setup with Debian 11.
1. Add Erlang GPG Key and Repository
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 following command to import the Erlang GPG key:
curl -fsSL https://packages.erlang-solutions.com/debian/erlang_solutions.asc | 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] https://packages.erlang-solutions.com/debian bullseye contrib" | sudo tee /etc/apt/sources.list.d/erlang.list
Update your local package index with the command below:
sudo apt update
2. Install Erlang with APT
Finally, use the following command to install Erlang:
sudo apt install erlang -y
Now you can easily launch your Erlang shell on Debian 11 with the following command:
erl

Here are some common, 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
3. 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 Orcacore.com ~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:
erl
Compile the file program Hello World test you just created using the following command:
c(helloworld).

Next, compile the program:
helloworld:helloworld().

To exit from your Erl shell, run the command below:
q().
For more information, you can visit the Erlang Documentation page.
4. 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
Coclusion
At this point, you have learned to install Erlang on Debian 11 and create a sample project. Installing Erlang on Debian 11 is a straightforward process, especially when using the official Erlang Solutions repository. This ensures you get the latest stable version with all necessary dependencies.
Hope you enjoy it. You may also like these articles:
Reset Root Password on Debian 11