How To Install Erlang on Debian 11
In this tutorial, we will show you how to install Erlang on Debian 11. For those of you who didn’t know, Erlang is a functional, concurrent programming language designed specifically for systems with high availability requirements. Erlang was originally developed to be used in several large telecommunication systems. But it has now slowly made its foray into diverse sectors like eCommerce, computer telephony, and banking sectors as well.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Erlang programming language on a Debian 11 (Bullseye).
Prerequisites
- A server running one of the following operating systems: Debian 10 or Debian 11.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Erlang on Debian 11 Bullseye
Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following apt
commands in the terminal:
sudo apt update sudo apt upgrade sudo apt install dirmngr ca-certificates software-properties-common gnupg gnupg2 apt-transport-https curl
Step 2. Installing Erlang on Debian 11.
By default, Erlang is available on Debian 11 base repository. So, now run the following command below to add the Erlang repository to your Debian system:
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
Next, import the GPG key:
curl -fsSL https://packages.erlang-solutions.com/debian/erlang_solutions.asc | sudo gpg --dearmor -o /usr/share/keyrings/erlang.gpg
Once you add the repository to your Debian system, now install Erlang using the following commands:
sudo apt update sudo apt install erlang
Step 3. Accessing Erlang Shell.
Once successfully installed, to launch the shell environment, use the following command below:
erl
Now we test by writing a simple Hello World Erlang code:
nano helloworld.erl
Add the following file:
% Test to display Hello World Erlang Code -module(hellotest). -import(io,[fwrite/1]). -export([helloworld/0]). helloworld() -> fwrite("Hai Guys.. , Erlang World!\n").
Save and close the file, then execute using the following command:
root@idroot.us:~$ erl Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:6:6] [ds:4:4:16] [async-threads:2] Eshell V11.1 (abort with ^G) 1> c(hellotest). {ok,hellotest} 2> hellotest01,helloworld(). ** exception error: undefined shell command helloworld/0 3> hellotest01:helloworld(). Hai Guys.. , Erlang World! ok
Congratulations! You have successfully installed erlang. Thanks for using this tutorial for installing the latest version of the Erlang programming language on Debian 11 Bullseye. For additional help or useful information, we recommend you check the official Erlang website.