Erlang is a general-purpose programming language and runtime environment maintained by Ericsson OTP product unit. It is used to build scalable real-time systems for high availability. It has built-in support for concurrency, distribution, and fault tolerance. Generally, it is used in telecoms, banking, e-commerce, computer telephony and instant messaging.

In this tutorial, I will show you how to install Erlang on Debian 10.

Prerequisites

  • A server running Debian 10.
  • A root password is configured on the server.

Getting Started

First, update all your system packages to the latest version with the following command:

apt-get update -y

Once your system is up-to-date, run the following command to install other required dependencies:

apt-get install curl gnupg apt-transport-https debian-keyring debian-archive-keyring -y

After installing all dependencies, you can proceed to the next step.

Install Erlang

By default, the Erlang package is not included in the Debian 10 default repository. So you will need to add the Erlang repository to APT.

First, download and add the GPG key with the following command:

wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | apt-key add -

Next, add the Erlang repository with the following command:

echo "deb https://packages.erlang-solutions.com/ubuntu bionic contrib" | tee /etc/apt/sources.list.d/rabbitmq.list

Next, update the repository and install the Erlang with the following command:

apt-get update -y

apt-get install erlang -y

Once the Erlang is installed, verify the Erlang version with the following command:

erl

You should see the following output:

Erlang/OTP 23 [erts-11.1.7] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1]

Eshell V11.1.7  (abort with ^G)

Press CTRL C and type a to exit from the Erlang

How to Use Erlang

First, connect to the Erlang with the following command:

erl

Output:

Erlang/OTP 23 [erts-11.1.7] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1]

Eshell V11.1.7  (abort with ^G)

Next, perform some mathematical operations as shown below:

1> 5   10.
15
2> (5   9) * 12/3.  
56.0
2>BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
       (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution

Press CTRL C and type a to exit from the Erlang

Next, create a simple “Hello World ” application:

nano hellotest01.erl

Add the following code:

 % Test to display Hello World Erlang Code
-module(hellotest01).
-import(io,[fwrite/1]).
-export([helloworld/0]).
helloworld() ->
fwrite("Hai Guys.. , Erlang World!n").

Save and close the file then connect to the Erlang with the following command:

erl

Output:

Erlang/OTP 23 [erts-11.1.7] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1]

Eshell V11.1.7  (abort with ^G)

Next, run the “Hello World ” application as shown below:

1> c(hellotest01).
{ok,hellotest01}
2> hellotest01:helloworld().
Hai Guys.. , Erlang World!
ok
3> 

Conclusion

Congratulations! you have successfully installed Erlang on Debian 10. For more information, read the Erlang documentation. 

<img alt="Hitesh Jethva" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/04/echo/hitesh-80.jpg" ezimgfmt="rs rscb3 src ng ngcb3" src="data:image/svg xml,”>

About Hitesh Jethva

Over 8 years of experience as a Linux system administrator. My skills include a depth knowledge of Redhat/Centos, Ubuntu Nginx and Apache, Mysql, Subversion, Linux, Ubuntu, web hosting, web server, Squid proxy, NFS, FTP, DNS, Samba, LDAP, OpenVPN, Haproxy, Amazon web services, WHMCS, OpenStack Cloud, Postfix Mail Server, Security etc.