How to install Erlang on Ubuntu 20.04 LTS Linux

Learn the commands to install Erlang programming language on Ubuntu 20.04 LTS Focal fossa Linux and also an example to create Hello World program. 

Erlang is an open-source programming language that is nowadays often used for (massively) parallel programming and distributed systems. However, the origins lie in applications in the field of telecommunications, the language was developed for and at Ericsson.

Their strength is the parallel processing of program logic, a very efficient and lightweight notification system for interprocess communication as well as pronounced fault tolerance. Furthermore, erlang makes it possible to replace or update modules at the runtime of the program without rebooting, whereby a high availability of the system is achieved.

There are not many applications in the desktop area that are based on this language. Some examples are the XMPP server, RabbitMQ server, the document-oriented database CouchDB, the web server Yaws, and application wings3d.

Erlang is a functional programming language. This means that a complete Erlang program consists exclusively of a series of functions and their calls. In contrast to imperative programming languages, there is no “schedule” of a program, but the flow is determined by functions, their return values, and events. Erlang manages almost without loops and assignments but increasingly relies on recursions. Erlang programs consist almost exclusively of modules that interact with each other. Each function is written into a module and nested in the modules together.

One of Erlang’s strengths is that you can easily change code at run time. So you don’t have to stop a server application to fix something or fix a bug, but you can simply replace the corresponding module at runtime. As a result, Erlang programs achieve high availability. Ericsson has estimated the availability of its Erlang systems at over 99% per year.

Steps to install Erlang programming language on Ubuntu 20.04 LTS

Estimated reading time: 5 minutes

The steps given here can be used for other versions of Ubuntu such as 22.04 or 18.04 including Debian 11 or Linux Mint.

1. Run system update

Let’s install the latest available updates for Ubuntu 20.04 using the system’s default package manager APT.

sudo apt update

Also, install common tools:

sudo apt install curl wget gnupg apt-transport-https -y

2. Add Erlang GPG key

To install the packages from the official repository of Erlang, the system needs to verify the package we are getting are in the same state as they were released by its developers. For that GPG key is needed. Let’s add that:

curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/erlang.gpg

3. Add Erlang repository on Ubuntu 20.04

Although we don’t need to add the repository to get the packages for installing Erlang on Ubuntu 20.04, however, the version will not be the latest. Therefore, to get the latest version of this programming language, here we are adding Erlang’s official repository, manually.

echo "deb [signed-by=/usr/share/keyrings/erlang.gpg] $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/erlang.list

Run system update:

To rebuild the APT package index cache, run:

sudo apt update

4. Install Erlang on Ubuntu 20.04

After adding the repository, we can download and install the latest version of Erlang on our Ubuntu 20.04 desktop or server system using the APT package manager. Here is the command to follow:

sudo apt install erlang
Install Erlang on Ubuntu 20.04 LTS Linux

5. Erlang Shell

To test Erlang programs, to maintain, or just to play around with Erlang a bit, the Erlang shell is ideal. This automatically gets installed with Erlang.



start erlang shell command

6. HelloWorld Program

Let’s try to create a simple program. In most languages, the Hello World program is the first thing you write. This can also be done in Erlang, but it should be clear that this looks a bit complicated in Erlang, as Erlang has its strength in complexity and not in simple programs.

First, you create a file hello.erl with the following content:

Create a file to write code:

nano hello.erl

Paste the following code:

-module(hello).  % 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 How2shout ~n").  % What is to happen when the function is called, here: Hello world is to be written on the screen.

Save the file using Ctrl+O, hit the Enter key, and Ctrl+X to exit the text editor.

Compile and run the created erlang program. 

Switch to erlang shell:


Now, compile the program using:


Run the program:


You will have the output:

Hello World How2shout

Erl helloworld program

To exit the ERLang Shell: 

Ctrl+G and then type q and hit the Enter key.

7. Uninstall or Remove Erlang from Ubuntu 20.04

In the future, if you want to completely remove Erlang from Ubuntu 20.04, here is the command to do that:

sudo apt autoremove --purge erlang
Remove Erlang from Ubuntu 20.04

Other Articles:

How to Install RabbitMQ Server on Ubuntu 20.04 LTS
Install the latest R Programming Language version on Debian 11
Install Yandex Browser on Ubuntu 20.04 LTS Linux
How to Install SSH Server on Ubuntu 20.04 LTS


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.