Erlang which is also known as Erlang/OTP, or Open Telecom Platform (OTP) is a programming language with similar syntax to other functional languages such as Haskell and Lisp. It is designed to build scalable, distributed, and fault-tolerant systems. At Ericsson Telecom in Sweden, it was created by Joe Armstrong, Robert Virding, and Mike Williams around 37 years ago, which makes it quite trustable. That’s why Erlang has been used to build many high-profile systems, including the telephony infrastructure of Ericsson, WhatsApp, and RabbitMQ, among others.
The programming language further supports pattern matching, higher-order functions, and immutable data structures. Its library also provides support for network programming, regular expressions, and concurrency, among other things. Here we learn:
Steps to install the latest version of Erlang on Amazon Linux 2 – AWS EC2
1. Refresh Amazon Linux 2
Let’s first refresh the YUM package manager cache on Amazon Linux and also install the updates, if available for the existing packages.
sudo yum update
Also, install wget:
sudo yum install wget
2. Download Erlang’s latest version
Well, we can install Erlang using the EPEL repository on Amazon Linux 2, however, the version available through it for this programming language is old. Therefore, we manually need to visit the website of Erlang Solutions to download the latest version of it available for CentOS 7.

While writing this article the latest version was 25.0.3, so we have downloaded that. If you want to use the command terminal to get it then, right-click on the Download button and copy the link.
After that use with wget command, as shown below:
wget paste-link
For example, for version 25.0.3:
wget https://packages.erlang-solutions.com/erlang/rpm/centos/7/x86_64/esl-erlang_25.0.3-1~centos~7_amd64.rpm
3. Installing Erlang on Amazon Linux 2
Once you have the RPM package of Erlang on your Amazon Linux, use the YUM package manager and install it:
sudo yum install esl-erlang_25.0.3-1~centos~7_amd64.rpm

4. Switch to ERL Shell
After completing the installation successfully, we can use the Erlang Shell and create programs to run and test using it
erl
Output:
[ec2-user@amazonlinux ~]$ erl
Erlang/OTP 25 [erts-13.0.3] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1]
Eshell V13.0.3 (abort with ^G)
1>
To quit or exit the Erlang Shell press Ctrl+G and then type – q and press Enter key.
5. Create a test 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.
In the same directory where you have created the file switch to the Erlang shell:
erl
Now, compile the program using:
c(hello).
Run the program:
hello:helloworld().
You will have the output:
Hello World How2shout

6. Exit the ERLang Shell:
To exit the Erlang Shell, first press Ctrl+G and then type q after that hit the Enter key to quit the shell window.
7. Uninstall or Remove Erlang from Amazon Linux
In the future, if you want to completely remove Erlang from AWS Linux, here is the command to do that:
sudo yum remove erlang
Other Articles: