Install Erlang on Ubuntu 22.04: Reliable Programming

This tutorial intends to teach you to Install Erlang on Ubuntu 22.04. Erlang is a functional programming language and runtime environment. If you have asked yourself Why should you use Erlang in your project? Here are some amazing features of Erlang that you can interest in this programming language:

  • Concurrency
  • Scalability
  • Fault-Tolerance
  • Hot Swapping
  • High Availability
  • Reliability

In this guide on the Orcacore website, you will learn to Install Erlang in the latest version by importing its repository to your Ubuntu 22.04.

How To Install Erlang on Ubuntu 22.04?

To complete the Erlang setup on the Ubuntu 22.04 system, you must log in to your server as a non-root user with sudo privileges. For this purpose, you can follow this guide on Initial Server Setup with Ubuntu 22.04.

Now follow the steps below to complete this guide for Erlang Programming Language setup on Ubuntu 22.

Step 1 – Add Erlang GPG Key on Ubuntu 22.04

To install the Erlang LTS, you must import the GPG key and its repository. First, run the system update with the following command:

sudo apt update 

Then, install the required packages with the command below:

sudo apt install software-properties-common apt-transport-https lsb-release

Next, use the following curl command to import the Erlang GPG key:

curl -fsSL https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/erlang.gpg

Step 2 – Erlang Installation on Ubuntu 22.04

At this point, run the system update and install Erlang by using the following command:

# sudo apt update 
# sudo apt install erlang

Step 3 – How To Access Erlang Shell?

Now to access your Erlang shell on Ubuntu 22.04, simply run the command below:

erl

In your output, you will see:

Access Erlang Shell

Step 4 – Test Erlang Programming Language

At this point, you can create a test program to see that your Erlang is working correctly.

To do this, create a sample hello world file with the following command:

vi hello.erl

Add the following Erlang code to the file:

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

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

When you are done, save and close the file.

Then, log in to your Erlang shell with the command below:

erl

Then, from your Erlang shell compile your program with the following command:

c(hello).

Next, run your program with the command below:

hello:helloworld().

You can see the steps as shown below:

Erlang/OTP 24 [erts-12.2.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit]

Eshell V12.2.1  (abort with ^G)
1> c(hello).
{ok,hello}
2> hello:helloworld().
Hello, Erlang World!
ok
3>

As you can see your Erlang is working correctly on your server. You are done with the Erlang installation on Ubuntu 22.04.

Conclusion

At this point, you have learned to Install Erlang LTS on Ubuntu 22.04, access your Erlang sell, and test whether your app is working correctly or not. Erlang has amazing features that you can use to create your programs.

Hope you enjoy it. You may also interested in these articles:

Install Gnome Desktop Environment on Ubuntu 22.04

Set up OpenJDK 17 on Ubuntu 20.04

FAQs

What is Erlang Used For?

Erlang is a programming language used for building highly concurrent, distributed, and fault-tolerant systems. It is widely used in telecommunications, messaging platforms, and scalable backend services.

How do I verify the Erlang installation?

You can use the erl command to access your Erlang programming language shell. In this way, you can verify your installation.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!