How to Install Erlang on Fedora 35 (Step-by-Step Guide)

Learn how to install Erlang/OTP on Fedora 35 using DNF package manager or by building from source. Includes verification steps, a hello world example, and troubleshooting tips.

Erlang is a functional, general-purpose, concurrent programming language and garbage-collected runtime environment built for concurrency, fault tolerance, and distributed application architectures. Originally developed by Ericsson in 1986 for use in telecom systems, Erlang is now supported and maintained by the Ericsson OTP (Open Telecom Platform) product unit.

Erlang is widely used to power systems that require high availability and low latency, including messaging platforms like WhatsApp, distributed databases like CouchDB and Riak, and message brokers like RabbitMQ. Its lightweight process model and built-in support for distributed computing make it an excellent choice for building scalable, real-time applications.

In this guide, we will walk through how to install Erlang/OTP on a Fedora 35 Server or Workstation using two methods: from the PackageCloud RPM repository and by building from source.

Table of Contents

  1. Prerequisites
  2. Updating the system
  3. Method 1 - Installing Erlang from PackageCloud repository
  4. Method 2 - Building Erlang from source
  5. Verifying the Erlang installation
  6. Creating a Hello World program
  7. Uninstalling Erlang
  8. Troubleshooting
  9. Conclusion

Prerequisites

Before you begin, ensure you have the following:

  • A running Fedora 35 Server or Workstation installation
  • A user account with sudo privileges or root access
  • An active internet connection
  • At least 1 GB of free disk space (more if building from source)

Updating the System

Before installing any new packages, it is good practice to update existing system packages to their latest versions. This ensures compatibility and security patches are applied.

Update the system packages:

1
sudo dnf -y update

Install some useful utilities that will be needed during the installation process:

1
sudo dnf install -y vim curl wget

Method 1 - Installing Erlang from the PackageCloud Repository

This is the recommended and easiest way to install Erlang on Fedora 35. The RabbitMQ team maintains an Erlang RPM package on PackageCloud that is optimized for use with RabbitMQ but works perfectly well for general Erlang development.

Step 1: Add the Erlang repository

The Erlang package is distributed via Yum repositories on PackageCloud. Add the repository to your system by running:

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

This script will automatically detect your Fedora version, download the repository configuration file, and set up the GPG keys for package verification.

Note: You may see a warning about pygpgme not being found. This is a known issue on newer Fedora versions and does not affect the installation.

Step 2: Install Erlang

With the repository configured, install Erlang using DNF:

1
sudo dnf install -y erlang

DNF will resolve all dependencies automatically and install the Erlang/OTP runtime along with its standard libraries.

Method 2 - Building Erlang from Source

If you need a specific version of Erlang or want to customize the build, you can compile it from source.

Step 1: Install build dependencies

Install the required development tools and libraries:

1
2
3
4
5
6
7
8
9
sudo dnf groupinstall -y "Development Tools"
sudo dnf install -y \
  ncurses-devel \
  openssl-devel \
  wxGTK-devel \
  unixODBC-devel \
  fop \
  libxslt \
  java-11-openjdk-devel

Step 2: Download the Erlang source

Visit the official Erlang downloads page to find the latest version. Download and extract the source tarball:

1
2
3
4
export OTP_VERSION="25.0"
wget https://github.com/erlang/otp/releases/download/OTP-${OTP_VERSION}/otp_src_${OTP_VERSION}.tar.gz
tar -xzf otp_src_${OTP_VERSION}.tar.gz
cd otp_src_${OTP_VERSION}

Step 3: Configure and build

Configure the build, compile, and install:

1
2
3
./configure --prefix=/usr/local
make -j$(nproc)
sudo make install

The --prefix=/usr/local flag installs Erlang into /usr/local, keeping it separate from system-managed packages. The -j$(nproc) flag uses all available CPU cores to speed up compilation.

Verifying the Erlang Installation

Regardless of which installation method you used, verify that Erlang is installed correctly.

Check the installed Erlang version:

1
erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell

You should see output similar to:

1
"25"

You can also launch the interactive Erlang shell:

1
erl

You should see the Erlang shell prompt:

1
2
3
4
Erlang/OTP 25 [erts-13.0] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1]

Eshell V13.0  (abort with ^G)
1>

Type q(). followed by Enter to exit the shell.

Creating a Hello World Program

Now that Erlang is installed, let us create a simple program to verify everything works end to end.

Step 1: Create the source file

Create a file named hello.erl:

1
vim hello.erl

Add the following Erlang code:

1
2
3
4
5
6
%% hello.erl - A simple Hello World module
-module(hello).
-export([greet/0]).

greet() ->
    io:fwrite("Hello from Citizix, Erlang World!~n").

Step 2: Compile and run

Open the Erlang shell in the same directory and compile the module:

1
erl

In the Erlang shell, compile and run the function. Remember to include the period (.) at the end of each command:

1
2
3
4
5
6
1> c(hello).
{ok,hello}
2> hello:greet().
Hello from Citizix, Erlang World!
ok
3> q().

You can also compile and run from the command line without entering the interactive shell:

1
2
erlc hello.erl
erl -noshell -s hello greet -s init stop

This will output:

1
Hello from Citizix, Erlang World!

Uninstalling Erlang

If you installed Erlang from the PackageCloud repository and need to remove it:

1
sudo dnf remove -y erlang

To also remove the repository:

1
2
sudo rm /etc/yum.repos.d/rabbitmq_erlang*.repo
sudo dnf clean all

If you installed from source:

1
2
cd otp_src_${OTP_VERSION}
sudo make uninstall

Troubleshooting

pygpgme warning during repository setup

If you see a warning about pygpgme during the repository setup, you can safely ignore it. This package is not available on newer Fedora versions but is not required for the installation to succeed.

Erlang command not found after source install

If erl is not found after building from source, ensure that /usr/local/bin is in your PATH:

1
2
echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

Dependency conflicts

If you encounter dependency conflicts during installation, try cleaning the DNF cache:

1
2
3
sudo dnf clean all
sudo dnf makecache
sudo dnf install -y erlang

OpenSSL version issues

Erlang requires OpenSSL for its crypto module. If you encounter SSL-related errors, ensure the OpenSSL development libraries are installed:

1
sudo dnf install -y openssl-devel

Conclusion

You have successfully installed Erlang/OTP on your Fedora 35 system. Erlang provides a robust foundation for building concurrent, distributed, and fault-tolerant applications. From here, you can explore the official Erlang documentation to learn more about the language, or install RabbitMQ which is one of the most popular applications built on the Erlang runtime.

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