How to install Erlang on Ubuntu 20.04

Erlang is a functional, general-purpose, concurrent programming language and garbage-collected runtime environment built for concurrency, fault tolerance, and distributed application architectures. It is supported and maintained by Ericsson OTP product unit.

In this guide, we will install Erlang/OTP in a Ubuntu 20.04.

Prerequisites

You need the following to follow along

  • Updated Ubuntu Server
  • Root access or user with root access
  • Internet access from the server

Table of Content

  1. Updating the system
  2. Installing Erlang
  3. Creating Hello world program

1. Updating the system

Let us ensure that our server packages are up to date using this command:

sudo apt update
sudo apt upgrade -y

Let us also install some common packages

sudo apt install -y vim

2. Installing Erlang

The erlang package is found on the default Ubuntu Leap repos. Install it using this command:

sudo apt install -y erlang

You should now have erlang installed.

3. Creating Hello world program

Create hello.erl file

vim hello.erl

Add this to the file

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

helloworld() ->
   fwrite("Hello from Citizix, 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 22 [erts-10.6.4] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1]

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

You have successfully installed Erlang in your system.

Conclusion

Thanks for using this tutorial for installing the Erlang programming language on your Ubuntu system. For additional help or useful information, we recommend you to check the official Erlang website.

comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy