How To Install Erlang on Debian 11 | Easy Steps – OrcaCore
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.
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:
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
How To Enable BBR on Debian 11
Upgrade Debian 10 to Debian 11
Alternative Installation Methods for Erlang on Debian 11
While the Erlang Solutions repository provides a convenient way to install Erlang on Debian 11, there are alternative methods you might consider, depending on your specific needs and preferences. These methods can be useful if you want more control over the Erlang version or if you encounter issues with the default installation process. Let’s explore two different approaches.
Method 1: Building Erlang from Source
Building Erlang from source gives you the most control over the installation process. You can choose specific versions, customize build options, and ensure compatibility with your system. However, it’s also the most complex and time-consuming method.
Steps:
-
Install Build Dependencies: Before you can build Erlang, you need to install the necessary build tools and libraries. This typically includes a C compiler, make, and various development libraries.
sudo apt update sudo apt install build-essential autoconf m4 libncurses5-dev libwxgtk3.0-gtk3-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev libssl-dev xsltproc fop libxml2-utils
-
Download the Erlang Source Code: Visit the Erlang official website or GitHub repository to download the source code for the desired version. For example, you can download the source using
wget
:wget https://github.com/erlang/otp/archive/OTP-24.3.4.tar.gz tar -xvf OTP-24.3.4.tar.gz cd otp-OTP-24.3.4
-
Configure and Build Erlang: Use the
configure
script to prepare the build environment, then usemake
to compile the code../configure make sudo make install
During the
configure
step, you can specify various options, such as the installation directory (--prefix=/opt/erlang
) or enable/disable specific features. -
Set Environment Variables: After the installation, you need to set the
ERL_HOME
environment variable to point to the Erlang installation directory, and add the Erlangbin
directory to yourPATH
. You can do this by adding the following lines to your~/.bashrc
or~/.zshrc
file:export ERL_HOME=/usr/local/erlang # Or wherever you installed Erlang export PATH=$ERL_HOME/bin:$PATH
Then, source your shell configuration file:
source ~/.bashrc
-
Verify the Installation: Finally, verify that Erlang is installed correctly by running
erl
.
Example:
Here’s a condensed example showing the build process:
sudo apt update && sudo apt install -y build-essential autoconf m4 libncurses5-dev libwxgtk3.0-gtk3-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev libssl-dev xsltproc fop libxml2-utils
wget https://github.com/erlang/otp/archive/OTP-24.3.4.tar.gz
tar -xvf OTP-24.3.4.tar.gz
cd otp-OTP-24.3.4
./configure --prefix=/usr/local/erlang
make
sudo make install
echo "export ERL_HOME=/usr/local/erlang" >> ~/.bashrc
echo "export PATH=$ERL_HOME/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
erl
This method provides granular control and the ability to customize the installation, but it requires more technical expertise and time.
Method 2: Using kerl
(Erlang Version Manager)
kerl
is a script that allows you to easily build and manage multiple Erlang installations on a single system. It simplifies the process of building from source and provides a convenient way to switch between different Erlang versions.
Steps:
-
Install
kerl
: Download and installkerl
using the following commands:curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl chmod a+x kerl sudo mv kerl /usr/local/bin/
-
Build and Install Erlang: Use
kerl
to build and install the desired Erlang version. First, update the kerl installations:kerl update releases
Then, build the Erlang version. Replace
24.3.4
with the desired version:kerl build 24.3.4 24.3.4
Finally, install the built version:
kerl install 24.3.4 /opt/erlang-24.3.4
-
Activate the Erlang Installation: To use the newly installed Erlang version, you need to activate it using
kerl use
.kerl use /opt/erlang-24.3.4
This will temporarily set the environment variables for the current shell session. To make the change permanent, you can add the
kerl use
command to your shell configuration file.
Example:
curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
chmod a+x kerl
sudo mv kerl /usr/local/bin/
kerl update releases
kerl build 24.3.4 24.3.4
kerl install 24.3.4 /opt/erlang-24.3.4
kerl use /opt/erlang-24.3.4
erl
kerl
simplifies the process of building and managing Erlang installations, making it a good option if you need to work with multiple Erlang versions or prefer a more automated approach than building from source manually. It is also an excellent method to install Erlang on Debian 11.
By exploring these alternative methods, you can choose the approach that best suits your needs and level of expertise for the install Erlang on Debian 11 process. The Erlang Solutions repository remains the easiest path, but these alternatives offer greater flexibility and control.
The process to install Erlang on Debian 11 has been outlined.