How to install Erlang programming language on Debian 10

How to install Erlang programming language on Debian 10

Erlang is a general programming language and runtime environment maintained by the Ericsson OTP product department. It is used to build a scalable real-time system to achieve high availability. It has built-in support for concurrency, distribution and fault tolerance. Generally, it is used for telecommunications, 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.
  • The root password is configured on the server.

getting Started

First, use the following command to update all system software packages to the latest version:

apt-get update -y

After the system is updated, 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. Therefore, you need to add the Erlang repository to APT.

First, use the following command to download and add the GPG key:

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

Next, add the Erlang repository using 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 Erlang using the following command:

apt-get update -yapt-get install erlang -y

Once Erlang is installed, use the following command to verify the Erlang version:

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 Erlang

How to use Erlang

First, connect to Erlang using 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 follows:

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 One Come out from 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 use the following command to connect to Erlang:

erl

Output: Advertising

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 follows:

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

in conclusion

Congratulations! You have successfully installed Erlang on Debian 10.For more information, please read Erlang Documentation.

Source

Related Posts