How To Install Erlang on Centos 7

In this guide, we want to teach you to Install Erlang Programming Language on Centos 7.

The Erlang programming language is a general-purpose, simultaneous, and garbage-collected programming language, which also serves as a runtime system. The sequential derivative of Erlang is a functional language with firm calculation, single assignment, and dynamic data entry, which concurrently follows the Actor model.

Steps To Install Erlang on Centos 7

To complete this guide, log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Centos 7.

Set up Erlang Programming Language on Centos 7

The Erlang packages are not provided in the Centos repository. So you need to add it manually on your server. First, update your local package index with the command below:

sudo yum update -y

Then, use the command below to install the Epel repository:

sudo yum install epel-release -y

Add Erlang Repository

Now you need to visit the Erlang Downloads page and get the latest RPM package by using the wget command:

# sudo wget https://packages.erlang-solutions.com/erlang-solutions-2.0-1.noarch.rpm
# sudo rpm -Uvh erlang-solutions-2.0-1.noarch.rpm

Install Erlang

Now, you can install the Erlang package on your Centos 7 using the following command:

sudo yum install erlang -y

Alternatively, you can do the complete Erlang installation. It includes the Erlang/OTP platform and all of its applications.

sudo yum install esl-erlang -y

Test Erlang Installation on Centos 7

At this point, you will learn to test your Erlang installation by creating a sample hello world project.

First, create a hello.erl file with your favorite text editor, here we use vi:

sudo vi hello.erl

Add the following content to the file:

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

helloworld() ->
   fwrite("Hello from OrcaCore, Erlang World!\n").

When you are done, save and close the file.

Then, you need to compile the program from your Erlang shell.

To access your Erlang shell on Centos 7, run the command below:

erl
Output
Erlang/OTP 24 [erts-12.3.2.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1]

Eshell V12.3.2.1  (abort with ^G)
1>

Then, run the commands below:

1> c(hello).
{ok,hello}
2> hello:helloworld().
Hello from OrcaCore, Erlang World!
ok

To exit from your Erl shell, run the command below:

3> q().

For more information, you can visit the Erlang Documentation page.

Conclusion

At this point, you have learned to Install Erlang on Centos 7 and create a sample project.

Hope you enjoy it. You may be like these articles:

How To Install OpenSSL 3 on Centos 7

How To Install OpenJDK 17 on Centos 7

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!