How to install Latest Erlang on Ubuntu 18.04 LTS

(: October 24, 2018)

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

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 18.04 LTS.

Step 1: Import Erlang GPG Key

Run the following commands to import Erlang repository GPG key{text-align:left} img{margin:0 auto 0 0}
wget -O- | sudo apt-key add -

Step 2: Add the Erlang Repository

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

echo "deb bionic contrib" | sudo tee /etc/apt/sources.list.d/rabbitmq.list

Step 3: Install Erlang

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

sudo apt update
sudo apt -y install erlang

To start  Erlang shell, run the 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)

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

$ cat hello.erl
% This is a test Hello World Erlang Code

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).

Then run the program from the Erlang shell:

2> hello:helloworld().
Hello, Erlang World!

See below screenshot:

You now have a working Erlang on your Ubuntu 18.04 LTS server/Desktop.{text-align:left} img{margin:0 auto 0 0}

Related Posts