How To

How To Install Erlang on Ubuntu 22.04|20.04|18.04

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

Original content from computingforgeeks.com - post 4339

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.

1. Install required dependencies

Run the following commands to install required packages.

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

2. Add Erlang Repository

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

curl -1sLf 'https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/setup.deb.sh' | sudo -E bash

Expected command execution output:

Executing the  setup script for the 'rabbitmq/rabbitmq-erlang' repository ...

   OK: Checking for required executable 'curl' ...
   OK: Checking for required executable 'apt-get' ...
   OK: Detecting your OS distribution and release using system methods ...
 ^^^^: ... Detected/provided for your OS/distribution, version and architecture:
 >>>>:
 >>>>: ... distro=ubuntu  version=22.04  codename=jammy  arch=x86_64
 >>>>:
   OK: Checking for apt dependency 'apt-transport-https' ...
   OK: Checking for apt dependency 'ca-certificates' ...
   OK: Checking for apt dependency 'gnupg' ...
   OK: Checking for apt signed-by key support ...
   OK: Importing 'rabbitmq/rabbitmq-erlang' repository GPG keys ...
   OK: Checking if upstream install config is OK ...
   OK: Installing 'rabbitmq/rabbitmq-erlang' repository via apt ...
   OK: Updating apt repository metadata cache ...
   OK: The repository has been installed successfully - You're ready to rock!

3. Install Erlang package

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 26 [erts-14.0.2] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit:ns]

Eshell V14.0.2 (press Ctrl+G to abort, type help(). for help)
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 Ubuntu 22.04|20.04|18.04 LTS server/Desktop. Enjoy building and running your applications powered by Erlang. All the best!.

Related Articles

Ubuntu Install Spark on Ubuntu (20.04, 22.04, 24.04) Containers How To Install Snap on Ubuntu or Debian Ubuntu Deploy Ceph Storage Cluster on Ubuntu 24.04 Databases How To Install MySQL Workbench on Ubuntu 22.04|20.04

3 thoughts on “How To Install Erlang on Ubuntu 22.04|20.04|18.04”

  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!

    Reply

Leave a Comment

Press ESC to close