Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Erlang runtime system has built-in support for concurrency, distribution and fault tolerance. This tutorial will help you to install erlang on CentOS/RHEL 7/6 operating system.
Step 1 – Setup Yum Repository
First of all, use the following commands to add Erlang apt repository on RHEL based system. You can simply download erlang repository package from its official website and install on your system.
sudo yum install epel-release wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm sudo rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
Step 2 – Install Erlang
Now, you can install erlang package on your system using the following command. This will install all of its dependencies as well.
sudo yum install erlang
Alternatively, you can do the complete Erlang installation. It includes the Erlang/OTP platform and all of its applications.
sudo yum install esl-erlang
Step 3 – Erlang Hello World Program
Let’s start with hello world program on erlang. First create file helloworld.erl with following content.
add the following contnet.
% hello world program -module(helloworld). -export([start/0]). start() -> io:fwrite("Hello World!\n").
Now compile the hello world program using below command.
The above command will create a file helloworld.beam in the current directory. You can run your program now.
erl -noshell -s helloworld start -s init stop Hello World!