AlmaLinuxRHEL Based

How To Install Erlang on AlmaLinux 10

Install Erlang on AlmaLinux 10

Erlang stands as one of the most powerful concurrent programming languages designed for building scalable, fault-tolerant distributed systems. When combined with AlmaLinux 10’s enterprise-grade stability, it creates an ideal environment for mission-critical applications. This comprehensive guide walks you through multiple installation methods, configuration steps, and troubleshooting techniques to get Erlang running smoothly on your AlmaLinux 10 system.

Whether you’re a system administrator preparing infrastructure for RabbitMQ, a developer building concurrent applications, or an enterprise architect designing distributed systems, this guide provides the expertise needed for a successful Erlang installation. We’ll cover everything from basic package manager installations to advanced source compilation techniques.

Table of Contents

What is Erlang and Why Use It on AlmaLinux 10?

Understanding Erlang/OTP

Erlang is a functional, general-purpose, concurrent programming language and garbage-collected runtime environment built specifically for concurrency, fault tolerance, and distributed application architectures. Developed and maintained by Ericsson OTP product unit, Erlang excels in creating systems that require high availability and real-time performance.

The language’s unique features include lightweight processes, message-passing concurrency, and hot code swapping capabilities. These characteristics make Erlang particularly valuable for telecommunications, banking, e-commerce, and instant messaging applications where downtime is not an option.

AlmaLinux 10 as the Perfect Host

AlmaLinux serves as a binary-compatible alternative to Red Hat Enterprise Linux, offering enterprise-grade stability without licensing costs. The distribution provides long-term support, security updates, and a robust package ecosystem that complements Erlang’s enterprise-focused design philosophy.

The combination of Erlang’s fault-tolerant architecture and AlmaLinux’s reliable foundation creates an environment where distributed applications can operate with maximum uptime and performance. This pairing is especially beneficial for organizations transitioning from proprietary enterprise solutions to open-source alternatives.

Prerequisites and System Requirements

Essential System Specifications

Before beginning the Erlang installation process, ensure your AlmaLinux 10 system meets these minimum requirements:

  • Operating System: Fresh or existing AlmaLinux 10 installation
  • Memory: Minimum 2GB RAM (4GB recommended for development)
  • Storage: At least 10GB available disk space
  • Network: Active internet connection for package downloads
  • Access: Root privileges or sudo access

Required Dependencies and Build Tools

Erlang installation requires several development packages and libraries. The core dependencies include gcc-libs, glibc, ncurses, openssl, and zlib. These components provide the foundation for Erlang’s runtime environment and compilation capabilities.

Execute the following command to install essential development tools:

sudo dnf groupinstall "Development Tools" -y
sudo dnf install wget curl vim git -y

Pre-Installation System Preparation

Update your AlmaLinux 10 system to ensure all packages are current:

sudo dnf update -y
sudo dnf install epel-release -y

Verify system architecture compatibility:

uname -m
cat /etc/os-release

Configure firewall settings if you plan to use distributed Erlang features:

sudo firewall-cmd --permanent --add-port=4369/tcp
sudo firewall-cmd --permanent --add-port=9100-9200/tcp
sudo firewall-cmd --reload

Installation Method Comparison

Installation Method Difficulty Level Customization Maintenance Best Use Case
DNF Package Manager Beginner Limited Automatic Production servers
Erlang Solutions Repo Intermediate Medium Semi-automatic Development environments
PackageCloud Repository Intermediate Medium Semi-automatic RabbitMQ integration
Source Compilation Advanced Complete Manual Custom requirements

Each installation method offers distinct advantages. Package manager installations provide simplicity and automatic updates. Repository-based methods offer newer versions and additional packages. Source compilation delivers maximum customization and latest features.

Method 1: Installation via DNF Package Manager

The DNF package manager approach represents the simplest path to Erlang installation on AlmaLinux 10. This method leverages the distribution’s built-in package management system for streamlined installation and maintenance.

Step 1: Enable PowerTools Repository

PowerTools repository contains development packages essential for Erlang functionality:

sudo dnf config-manager --set-enabled powertools
sudo dnf config-manager --set-enabled extras

Step 2: Install Erlang Package

Execute the installation command:

sudo dnf install erlang -y

The package manager automatically resolves dependencies and installs required components. This process typically takes 2-5 minutes depending on network speed and system performance.

Step 3: Verify Installation Success

Test the installation by launching the Erlang shell:

erl -version

Expected output should display version information similar to:

Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version X.X

Launch the interactive Erlang shell to confirm functionality:

erl

Within the Erlang shell, test basic operations:

1> 2 + 3.
5
2> io:format("Hello, AlmaLinux!~n").
Hello, AlmaLinux!
ok
3> halt().

Advantages and Limitations

Benefits:

  • Fastest installation method
  • Automatic dependency resolution
  • Integrated system updates
  • Minimal configuration required

Limitations:

  • May not include latest Erlang version
  • Limited customization options
  • Dependency on repository maintainers

Method 2: Installation from Erlang Solutions Repository

Erlang Solutions provides official packages optimized for enterprise environments. This method typically offers more recent versions than standard distribution repositories.

Step 1: Download and Install Repository Package

cd /tmp
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: Import GPG Security Keys

Security verification prevents package tampering:

sudo rpm --import https://packages.erlang-solutions.com/rpm/erlang_solutions.asc

Step 3: Refresh Package Cache

Update DNF cache to recognize the new repository:

sudo dnf makecache

Step 4: Install Erlang with Enhanced Packages

sudo dnf install erlang -y

This installation includes additional tools and libraries not available in standard repositories.

Step 5: Verify Enhanced Installation

erl -version
which erl
ls -la $(which erl)

Troubleshooting Repository Issues

Common problems include GPG key verification failures and repository connectivity issues. If you encounter package conflicts during updates, use the following resolution strategies:

# Clean package cache
sudo dnf clean all

# Reinstall with conflict resolution
sudo dnf reinstall erlang --allowerasing

Warning: The --allowerasing flag removes conflicting packages. Use cautiously in production environments.

Method 3: Installation from PackageCloud Repository

PackageCloud repository, maintained by the RabbitMQ team, provides Erlang packages optimized for message queue applications.

Step 1: Add PackageCloud Repository

Execute the automated repository installation script:

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

This script configures repository settings, imports GPG keys, and updates package cache automatically.

Step 2: Install Erlang Package

sudo dnf install erlang -y

Step 3: Verify PackageCloud Installation

erl

Expected output:

Erlang/OTP 24 [erts-12.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit]
Eshell V12.1 (abort with ^G)
1>

Integration Benefits

PackageCloud packages include optimizations for RabbitMQ compatibility, making this method ideal for message queue deployments. The repository maintains regular updates and security patches aligned with enterprise deployment requirements.

Method 4: Compilation from Source Code

Source compilation provides maximum control over Erlang features and optimizations. This method suits development environments and custom deployment scenarios.

Step 1: Install Build Dependencies

sudo dnf install gcc gcc-c++ make autoconf ncurses-devel openssl-devel \
                 unixODBC-devel wxGTK3-devel libxslt java-devel -y

Step 2: Download Erlang Source Code

Navigate to the source directory and download the latest release:

cd /usr/local/src
sudo wget https://github.com/erlang/otp/releases/download/OTP-28.0.2/otp_src_28.0.2.tar.gz
sudo tar -xzf otp_src_28.0.2.tar.gz
cd otp_src_28.0.2

Step 3: Configure Build Parameters

Set environment variables and configure compilation options:

export ERL_TOP=$(pwd)
export LANG=C

./configure --prefix=/usr/local/erlang \
           --enable-smp-support \
           --enable-threads \
           --enable-kernel-poll \
           --without-javac \
           --with-ssl \
           --enable-shared-zlib

Step 4: Compile and Install

Initiate the compilation process:

make -j$(nproc)
sudo make install

Compilation duration varies from 15-45 minutes depending on system specifications and enabled features.

Step 5: Configure Environment Variables

Create system-wide environment configuration:

sudo tee /etc/profile.d/erlang.sh << 'EOF'
export ERL_HOME=/usr/local/erlang
export PATH=$ERL_HOME/bin:$PATH
export MANPATH=$ERL_HOME/man:$MANPATH
EOF

sudo chmod +x /etc/profile.d/erlang.sh
source /etc/profile.d/erlang.sh

Step 6: Verify Source Installation

erl -version
which erl
erl -eval 'erlang:system_info(version).' -noshell -s init stop

Advanced Configuration Options

Source compilation supports numerous customization flags:

  • --enable-jit: Enable Just-In-Time compilation for performance
  • --disable-hipe: Disable High Performance Erlang for compatibility
  • --with-assumed-cache-line-size=64: Optimize memory alignment
  • --enable-m64-build: Force 64-bit compilation

Configuration and Environment Setup

System-Wide Configuration

Proper environment configuration ensures Erlang accessibility across user sessions and system services:

# Create systemwide configuration
sudo tee /etc/profile.d/erlang.sh << 'EOF'
#!/bin/bash
export ERL_HOME=/usr/local/erlang
export PATH=$ERL_HOME/bin:$PATH
export ERL_LIBS=$ERL_HOME/lib
EOF

User-Specific Configuration

Individual users can customize Erlang settings in their shell profiles:

echo 'export PATH=/usr/local/erlang/bin:$PATH' >> ~/.bashrc
echo 'export ERL_AFLAGS="-kernel shell_history enabled"' >> ~/.bashrc
source ~/.bashrc

Verification and Testing

Create a comprehensive test to validate installation completeness:

# Create test module
cat > hello_almalinux.erl << 'EOF' -module(hello_almalinux). -export([start/0, greet/1]). start() ->
    greet("AlmaLinux 10").

greet(Name) ->
    io:format("Hello, ~s! Erlang is running successfully.~n", [Name]).
EOF

# Compile and execute
erl -compile hello_almalinux
erl -noshell -eval 'hello_almalinux:start().' -s init stop

Expected output: Hello, AlmaLinux 10! Erlang is running successfully.

Common Installation Issues and Solutions

Package Conflict Resolution

Package conflicts frequently occur when multiple Erlang sources exist. The most common error appears as:

Error: cannot install both erlang-dialyzer-22.0.7-1.el8.x86_64 and erlang-dialyzer-24.1.7-1.el8.x86_64

Resolution Steps:

# Remove conflicting packages
sudo dnf remove erlang* -y

# Clean package cache
sudo dnf clean all

# Reinstall from preferred source
sudo dnf install erlang -y

Repository Access Problems

Network connectivity issues or GPG verification failures can prevent repository access:

# Verify repository configuration
sudo dnf repolist enabled | grep -i erlang

# Re-import GPG keys
sudo rpm --import https://packages.erlang-solutions.com/rpm/erlang_solutions.asc

# Test repository connectivity
curl -I https://packages.erlang-solutions.com/rpm/centos/

Shell Startup Failures

If the Erlang shell fails to start properly, the issue typically relates to terminal compatibility:

# Test with old shell mode
erl -oldshell

# Check terminal settings
echo $TERM

# Verify installation path
ls -la $(which erl)
stat $(which erl)

Permission and Path Issues

Incorrect file permissions or PATH configuration can prevent Erlang execution:

# Fix ownership issues
sudo chown -R root:root /usr/local/erlang
sudo chmod +x /usr/local/erlang/bin/*

# Verify PATH configuration
echo $PATH | tr ':' '\n' | grep -i erlang

# Test command resolution
which erl
type erl

Build Compilation Errors

Source compilation failures often result from missing dependencies or configuration issues:

# Install additional build requirements
sudo dnf install flex bison m4 perl

# Check system resources
df -h /tmp
free -h

# Verify compiler versions
gcc --version
make --version

Security and Hardening Considerations

System Security Configuration

Implement security best practices for production Erlang deployments:

# Create dedicated erlang user
sudo useradd -r -s /bin/false erlang

# Configure file permissions
sudo chown -R erlang:erlang /opt/erlang
sudo chmod 750 /opt/erlang

# Set up SELinux context
sudo setsebool -P allow_erlang_networking on

Network Security Settings

Configure firewall rules for distributed Erlang operations:

# Enable Erlang Port Mapper Daemon (EPMD)
sudo firewall-cmd --permanent --add-port=4369/tcp

# Configure distributed node communication range
sudo firewall-cmd --permanent --add-port=9100-9200/tcp

# Apply firewall changes
sudo firewall-cmd --reload

SSL/TLS Configuration

Enable secure communications for distributed Erlang nodes:

# Generate SSL certificates
sudo mkdir -p /etc/erlang/ssl
sudo openssl req -new -x509 -days 365 -nodes \
    -out /etc/erlang/ssl/erlang.pem \
    -keyout /etc/erlang/ssl/erlang.key

Access Control Implementation

Restrict Erlang shell access and implement authentication:

# Configure cookie-based authentication
echo "secure_random_cookie_$(date +%s)" | sudo tee /var/lib/erlang/.erlang.cookie
sudo chmod 400 /var/lib/erlang/.erlang.cookie

Performance Optimization and Tuning

Memory Management Configuration

Optimize Erlang’s memory allocation for your specific workload:

# Configure environment variables for performance
export ERL_AFLAGS="+K true +A 32 +MMmcs 30"
export ERL_MAX_ETS_TABLES=50000

Scheduler Optimization

Tune Erlang schedulers based on system CPU configuration:

# Detect CPU configuration
nproc
lscpu | grep -E '^Thread|^Core|^CPU\('

# Configure scheduler settings
export ERL_AFLAGS="+S 8:8 +sbt db +scl false"

I/O Performance Tuning

Enhance file and network I/O performance:

# Increase file descriptor limits
echo "* soft nofile 65536" | sudo tee -a /etc/security/limits.conf
echo "* hard nofile 65536" | sudo tee -a /etc/security/limits.conf

# Configure kernel parameters
echo "net.core.somaxconn = 65536" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

Post-Installation Development Setup

Development Tools Installation

Install essential development tools for Erlang programming:

# Install Rebar3 build tool
wget https://s3.amazonaws.com/rebar3/rebar3
chmod +x rebar3
sudo mv rebar3 /usr/local/bin/

# Verify installation
rebar3 version

IDE and Editor Configuration

Configure popular editors for Erlang development:

Visual Studio Code Setup:

# Install VS Code Erlang extension
code --install-extension pgourlain.erlang

Vim Configuration:

# Install Erlang syntax highlighting
mkdir -p ~/.vim/{syntax,ftdetect}
wget -O ~/.vim/syntax/erlang.vim https://raw.githubusercontent.com/vim-erlang/vim-erlang-runtime/master/syntax/erlang.vim
echo "au BufNewFile,BufRead *.erl,*.hrl setf erlang" > ~/.vim/ftdetect/erlang.vim

Project Structure Setup

Create a standardized project layout:

# Create development workspace
mkdir -p ~/erlang-projects/{apps,libs,tools}
cd ~/erlang-projects

# Generate sample application
rebar3 new app sample_app
cd sample_app
rebar3 compile

Testing Framework Installation

Set up unit testing capabilities:

# Create test directory structure
mkdir -p test/{unit,integration,system}

# Configure EUnit testing
cat > test/sample_test.erl << 'EOF' -module(sample_test). -include_lib("eunit/include/eunit.hrl"). simple_test() ->
    ?assertEqual(4, 2 + 2).
EOF

Monitoring and Maintenance

System Monitoring Setup

Implement comprehensive monitoring for Erlang applications:

# Install monitoring tools
sudo dnf install htop iotop nethogs -y

# Configure system monitoring
cat > monitor_erlang.sh << 'EOF'
#!/bin/bash
echo "=== Erlang Process Monitor ==="
ps aux | grep -E "(erl|beam)" | grep -v grep
echo "=== Memory Usage ==="
free -h
echo "=== Disk Usage ==="
df -h /opt/erlang
EOF

chmod +x monitor_erlang.sh

Log Management Configuration

Set up log rotation and management:

# Configure logrotate for Erlang logs
sudo tee /etc/logrotate.d/erlang << 'EOF'
/var/log/erlang/*.log {
    daily
    missingok
    rotate 30
    compress
    delaycompress
    notifempty
    create 644 erlang erlang
}
EOF

Update Management Strategy

Establish procedures for maintaining Erlang installations:

# Create update script
cat > update_erlang.sh << 'EOF'
#!/bin/bash
echo "Checking for Erlang updates..."
sudo dnf check-update | grep -i erlang

echo "Current Erlang version:"
erl -version

echo "Updating system packages..."
sudo dnf update -y
EOF

Congratulations! You have successfully installed Erlang. Thanks for using this tutorial for installing the Erlang programming language on your AlmaLinux OS 10 system. For additional help or useful information, we recommend you check the official Erlang website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button