How To Install Erlang on Rocky Linux 8

In this guide, we want to teach you How To Install Erlang on Rocky Linux 8.

Erlang is a functional programming language that was highly influential in the world of programming language design. It’s still widely used today and is a dynamically typed language that focuses on concurrency, distributed programs, and fault tolerance. Another interesting aspect of Erlang is that it supports hot swapping, meaning that code can be changed without stopping a system.

steps To Install Erlang on Rocky Linux 8

To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Rocky Linux 8.

Install Erlang Programming Language on Rocky Linux 8

First, you need to update your local package index with the following command:

sudo dnf update -y

Then, use the following command to install the Erlang PackageCloud Yum repository:

curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash
Output
Complete!
Generating yum cache for rabbitmq_erlang...
Importing GPG key 0xDF309A0B:
 Userid     : "https://packagecloud.io/rabbitmq/erlang (https://packagecloud.io/docs#gpg_signing) <[email protected]>"
 Fingerprint: 2EBD E413 D3CE 5D35 BCD1 5B7C 71C6 3471 DF30 9A0B
 From       : https://packagecloud.io/rabbitmq/erlang/gpgkey
Generating yum cache for rabbitmq_erlang-source...

The repository is setup! You can now install packages.

Now use the command below to install the Erlang programming language on your server:

sudo dnf install erlang -y

When your installation is completed, you can test your Erlang language.

Create a sample project with Erlang

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 Rocky Linux 8, run the command below:

erl
Output
Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit:ns]

Eshell V13.0.4  (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 Rocky Linux 8 and create a sample project.

Hope you enjoy it.

You may be like these articles:

How To Set up CloudLinux on Centos

How To Install Webmin on Centos 7

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!