Erlang is a functional, general-purpose, concurrent programming language and garbage-collected runtime environment supported and maintained by Ericsson OTP product unit.

How to Install Ansible in Linux, ma...
How to Install Ansible in Linux, macOS & Windows, 15+ examples

Erlang programming language was built for concurrency, fault tolerance, and distributed application architectures. OTP (Open Telecom Platform) is a collection of libraries and middleware for Erlang. This guide will show you how you can install and use the latest release of  Erlang/OTP on Ubuntu 22.04|20.04|18.04 LTS.

Step 1: Import Erlang GPG Key

Run the following commands to import Erlang repository GPG key:

sudo apt update
sudo apt install curl software-properties-common apt-transport-https lsb-release
curl -fsSL https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/erlang.gpg

Step 2: Add Erlang Repository to Ubuntu 22.04|20.04|18.04

Once you have imported the key, add the repository to your Ubuntu 22.04|20.04|18.04 system by running the following commands:

Ubuntu 22.04:

sudo apt update
sudo apt install erlang

Ubuntu 20.04 / 18.04:

echo "deb https://packages.erlang-solutions.com/ubuntu $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/erlang.list

Step 3: Install Erlang on Ubuntu 22.04|20.04|18.04

The last step is the actual installation of Erlang. Update your system package list and install Erlang:

sudo apt update
sudo apt install erlang

To start  Erlang shell, run the command:

$ erl
Erlang/OTP 24 [erts-12.1.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit]

Eshell V12.1.4  (abort with ^G)
1> ^G
 --> q

After the shell is started, another prompt is printed. You can test by writing a simple Hello World Erlang code.

$ vim hello.erl
% This is a test Hello World Erlang Code
-module(hello).
-import(io,[fwrite/1]).
-export([helloworld/0]).

helloworld() ->
   fwrite("Hello, Erlang World!\n").

Compile it from the Erlang shell. Don’t forget the full-stop (“period“) at the end of each command.

$ erl
Erlang/OTP 21 [erts-10.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1]

Eshell V10.1  (abort with ^G)
1> c(hello).
{ok,hello}

Then run the program from the Erlang shell:

2> hello:helloworld().
Hello, Erlang World!
ok
3> ^G
--> q

See below screenshot:

erlang hello world min

You now have a working Erlang on your Ubuntu22.04|20.04|18.04 LTS server/Desktop.

YOU CAN SUPPORT OUR WORK WITH A CUP OF COFFEE


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

PayPal Support
Previous articleHow to delete Elasticsearch Index data with curl
Next articleInstall RabbitMQ Server on Ubuntu 22.04|20.04|18.04
Founder of Computingforgeeks. Expertise in Virtualization, Cloud, Linux/UNIX Administration, Automation,Storage Systems, Containers, Server Clustering e.t.c.

3 COMMENTS

  1. I used these instructions a while ago and they worked fine, but recently I’ve been getting a Forbidden error because “https://dl.bintray.com/rabbitmq-erlang/debian focal InRelease” is no longer signed. I just now tried importing the Erlang GPG Key again, but it didn’t help. Any thoughts? Thanks!

LEAVE A REPLY

Please enter your comment!
Please enter your name here