How to install Erlang on Fedora 35

Erlang is a functional, general-purpose, concurrent programming language and garbage-collected runtime environment built for concurrency, fault tolerance, and distributed application architectures. It is supported and maintained by Ericsson OTP product unit.

In this guide, we will install Erlang/OTP in a Fedora 35 Server/Workstation.

Prerequisites

You need the following to follow along

  • Updated Fedora server/Workstation
  • Root access or user with root access
  • Internet access from the server

Table of Content

  1. Updating the system
  2. Installing Erlang
  3. Creating Hello world program

1. Updating the system

Let us ensure that our server packages are up to date using this command:

sudo dnf -y update

Let us also install some common packages

sudo dnf install vim -y

2. Installing Erlang

The Erlang package is distributed via Yum repositories on PackageCloud. Install the PackageCloud Yum repository using this command:

curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash

This is the output on my server

$ curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash
Detected operating system as fedora/34.
Checking for curl...
Detected curl...
Downloading repository file: https://packagecloud.io/install/repositories/rabbitmq/erlang/config_file.repo?os=fedora&dist=34&source=script
done.
Installing pygpgme to verify GPG signatures...
rabbitmq_erlang-source                                                                                                                                                1.2 kB/s | 819  B     00:00
rabbitmq_erlang-source                                                                                                                                                 21 kB/s | 3.8 kB     00:00
Importing GPG key 0xDF309A0B:
 Userid     : "https://packagecloud.io/rabbitmq/erlang (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>"
 Fingerprint: 2EBD E413 D3CE 5D35 BCD1 5B7C 71C6 3471 DF30 9A0B
 From       : https://packagecloud.io/rabbitmq/erlang/gpgkey
rabbitmq_erlang-source                                                                                                                                                364  B/s | 296  B     00:00
Last metadata expiration check: 0:00:01 ago on Fri 12 Nov 2021 07:05:33 PM UTC.
No match for argument: pygpgme
Error: Unable to find a match: pygpgme

WARNING:
The pygpgme package could not be installed. This means GPG verification is not possible for any RPM installed on your system.
To fix this, add a repository with pygpgme. Usualy, the EPEL repository for your system will have this.
More information: https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F

Installing yum-utils...
rabbitmq_erlang-source                                                                                                                                                3.2 kB/s | 951  B     00:00
Dependencies resolved.
======================================================================================================================================================================================================
 Package                                         Architecture                                 Version                                             Repository                                     Size
======================================================================================================================================================================================================
Installing:
 dnf-utils                                       noarch                                       4.0.24-1.fc34                                       updates                                        37 k

Transaction Summary
======================================================================================================================================================================================================
Install  1 Package

Total download size: 37 k
Installed size: 23 k
Downloading Packages:
dnf-utils-4.0.24-1.fc34.noarch.rpm                                                                                                                                    656 kB/s |  37 kB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                 120 kB/s |  37 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                              1/1
  Installing       : dnf-utils-4.0.24-1.fc34.noarch                                                                                                                                               1/1
  Running scriptlet: dnf-utils-4.0.24-1.fc34.noarch                                                                                                                                               1/1
  Verifying        : dnf-utils-4.0.24-1.fc34.noarch                                                                                                                                               1/1

Installed:
  dnf-utils-4.0.24-1.fc34.noarch

Complete!

WARNING:
The yum-utils package could not be installed. This means you may not be able to install source RPMs or use other yum features.

Generating yum cache for rabbitmq_erlang...
Generating yum cache for rabbitmq_erlang-source...

The repository is setup! You can now install packages.

Now we can install erlang from the added repos:

<meta charset="utf-8">sudo dnf install erlang

3. Creating Hello world program

Create hello.erl file

vim hello.erl

Add this to the file

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

helloworld() ->
   fwrite("Hello from Citizix, 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 23 [erts-11.2.2.7] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]

Eshell V11.2.2.7  (abort with ^G)
1> c(hello).
{ok,hello}
2> hello:helloworld().
Hello from Citizix, Erlang World!
ok
3>

You have successfully installed Erlang in your system.

Conclusion

Thanks for using this tutorial for installing the Erlang programming language on your Fedora 35 system. For additional help or useful information, we recommend you to check the official Erlang website.

comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy