DebianDebian Based

How To Install Erlang on Debian 13

Install Erlang on Debian 13

Erlang stands as one of the most robust programming languages for building distributed, fault-tolerant systems. Originally developed by Ericsson for telecommunications applications, this concurrent programming language has evolved into a cornerstone technology for modern distributed computing. Its unique actor model and “let it crash” philosophy make it indispensable for applications requiring high availability and scalability.

Debian 13 provides an excellent foundation for Erlang development and deployment. The distribution’s stability, extensive package repositories, and long-term support make it an ideal choice for production environments running Erlang applications. Whether you’re developing real-time messaging systems, IoT platforms, or distributed databases, installing Erlang on Debian 13 ensures optimal performance and reliability.

This comprehensive guide covers four distinct installation methods: package manager installation, repository-based installation, source compilation, and version manager setup. You’ll learn prerequisite requirements, step-by-step procedures, verification techniques, and troubleshooting solutions. By the end, you’ll have a fully functional Erlang environment tailored to your specific development needs.

Prerequisites and System Requirements

System Requirements for Debian 13

Before installing Erlang on your Debian 13 system, ensure your hardware meets the minimum specifications. A modern x86_64 processor with at least 1GB of RAM provides adequate performance for basic Erlang development. However, production environments benefit from 4GB or more RAM, especially when running concurrent processes or distributed applications.

Disk space requirements vary significantly depending on your chosen installation method. Package manager installations require approximately 200MB, while full source compilation with all optional features may consume up to 1GB. Plan for additional space if you intend to install multiple Erlang versions or extensive development tools.

Essential Packages and Dependencies

Successful Erlang installation depends on several fundamental packages. Update your system’s package list before proceeding with any installation method:

sudo apt update && sudo apt upgrade -y

Install essential build tools and development libraries that Erlang requires for optimal functionality:

sudo apt install -y build-essential autoconf m4 libncurses5-dev libwxgtk3.0-gtk3-dev libwxgtk-webview3.0-gtk3-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils libncurses-dev openjdk-11-jdk

These packages enable SSL support, graphical user interface components, database connectivity, and documentation generation. The development headers ensure proper compilation when building from source or installing packages with native extensions.

Security and Permission Considerations

Administrative privileges are necessary for system-wide Erlang installations. Ensure your user account has sudo access or appropriate permissions for package installation. For enhanced security, consider creating a dedicated development user for Erlang projects, limiting potential system-wide impacts.

Method 1: Installing Erlang via APT Package Manager

Standard Repository Installation

The simplest approach utilizes Debian’s default package repositories. This method provides tested, stable Erlang versions integrated with the system’s package management:

sudo apt update
sudo apt install erlang

This command installs the complete Erlang/OTP distribution including the runtime system, standard libraries, and development tools. The default installation typically includes essential applications like compiler, debugger, and standard library modules.

Verify the installation by checking the Erlang version:

erl -version

Installing from Erlang Solutions Repository

For access to newer Erlang versions, add the official Erlang Solutions repository. This approach provides more recent releases while maintaining package management convenience:

First, download and install the repository GPG key:

wget -O- https://packages.erlang-solutions.com/debian/erlang_solutions.asc | sudo gpg --dearmor -o /usr/share/keyrings/erlang-solutions-archive-keyring.gpg

Add the repository to your system’s sources list:

echo "deb [signed-by=/usr/share/keyrings/erlang-solutions-archive-keyring.gpg] https://packages.erlang-solutions.com/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/erlang-solutions.list

Update package lists and install Erlang:

sudo apt update
sudo apt install esl-erlang

This installation method provides the latest stable Erlang release with all standard OTP applications and tools.

Method 2: Installing from RabbitMQ Team Repository

Repository Configuration and Key Management

The RabbitMQ team maintains an excellent Erlang repository with optimized packages for message queue applications. This method ensures compatibility with RabbitMQ and provides regular security updates.

Import the RabbitMQ signing key for package verification:

curl -1sLf 'https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key' | sudo gpg --dearmor -o /usr/share/keyrings/rabbitmq-erlang-archive-keyring.gpg

Configure the repository source:

echo "deb [signed-by=/usr/share/keyrings/rabbitmq-erlang-archive-keyring.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/debian $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/rabbitmq-erlang.list

Installation Process

Update your package cache and install Erlang from the RabbitMQ repository:

sudo apt update
sudo apt install erlang-base erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key erlang-runtime-tools erlang-snmp erlang-ssl erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl

This granular installation allows precise control over included Erlang modules. For a complete installation, use:

sudo apt install erlang

The RabbitMQ repository provides excellent package maintenance and security updates, making it ideal for production environments.

Method 3: Building Erlang from Source Code

Downloading and Preparing Source Code

Source compilation offers maximum flexibility and optimization opportunities. Download the latest Erlang/OTP source code from the official repository:

cd /tmp
wget https://github.com/erlang/otp/releases/download/OTP-28.0.2/otp_src_28.0.2.tar.gz

Extract the archive and navigate to the source directory:

tar -xzf otp_src_28.0.2.tar.gz
cd otp_src_28.0.2

Configuration and Compilation

Configure the build system with optimization flags suitable for your hardware:

./configure --prefix=/usr/local --enable-threads --enable-smp-support --enable-kernel-poll --enable-hipe --with-ssl --enable-shared-zlib --enable-dynamic-ssl-lib

These configuration options enable:

  • Thread support for concurrent processing
  • SMP support for multi-core systems
  • Kernel polling for improved I/O performance
  • HiPE native code compilation
  • SSL/TLS cryptographic support
  • Shared zlib compression library

Compile the source code using all available CPU cores:

make -j$(nproc)

The compilation process typically takes 15-30 minutes depending on system specifications. Monitor for any error messages indicating missing dependencies or configuration issues.

Installation and System Integration

Install the compiled Erlang system:

sudo make install

Update your shell’s PATH environment variable to include Erlang binaries:

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

This source-based installation provides the latest features and optimal performance tuning for your specific hardware configuration.

Method 4: Using Version Managers (kerl/asdf)

Installing and Configuring kerl

Version managers simplify maintaining multiple Erlang installations for different projects. Kerl provides dedicated Erlang version management with build customization capabilities.

Download and install kerl:

curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
chmod a+x kerl
sudo mv kerl /usr/local/bin/

Configure kerl environment variables:

export KERL_CONFIGURE_OPTIONS="--enable-smp-support --enable-threads --enable-kernel-poll --enable-hipe --with-ssl"
export KERL_BUILD_DOCS="yes"

List available Erlang releases:

kerl list releases

Build and install a specific Erlang version:

kerl build 26.0.2 erlang_26.0.2
kerl install erlang_26.0.2 ~/erlang/26.0.2

Activate the installation:

source ~/erlang/26.0.2/activate

Alternative: asdf Version Manager

Asdf provides multi-language version management including Erlang support. Install asdf following the official documentation, then add the Erlang plugin:

asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git

Install and set a specific Erlang version:

asdf install erlang 26.0.2
asdf global erlang 26.0.2

Version managers excel in development environments requiring multiple Erlang versions or easy switching between releases.

Verification and Testing Installation

Testing Erlang Shell Functionality

Verify your installation by launching the Erlang shell:

erl

The shell should display version information and present an interactive prompt. Test basic functionality with simple expressions:

1> 2 + 3.
5
2> math:sqrt(16).
4.0
3> q().

The q(). command exits the shell gracefully.

Creating and Running a Hello World Program

Create a simple Erlang module to test compilation and execution:

nano hello.erl

Add the following content:

-module(hello).
-export([world/0]).

world() ->
    io:format("Hello, World!~n").

Compile and run the program:

erlc hello.erl
erl -noshell -s hello world -s init stop

Successful execution displays “Hello, World!” confirming proper installation and functionality.

Verifying OTP Applications

Check available OTP applications:

erl -eval 'application:loaded_applications().' -noshell -s init stop

This command lists all loaded applications, verifying the completeness of your Erlang installation.

Configuration and Optimization

Environment Variables Setup

Configure essential environment variables for optimal Erlang operation. Add these settings to your shell profile:

export ERL_HOME="/usr/local/lib/erlang"
export PATH="$ERL_HOME/bin:$PATH"
export ERL_LIBS="/usr/local/lib/erlang/lib"

For system-wide configuration, add these variables to /etc/environment:

sudo echo 'ERL_HOME="/usr/local/lib/erlang"' >> /etc/environment
sudo echo 'ERL_LIBS="/usr/local/lib/erlang/lib"' >> /etc/environment

Performance Tuning Basics

Optimize Erlang runtime performance through system-level configuration. Increase file descriptor limits for applications handling many concurrent connections:

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 for improved network performance:

echo "net.core.rmem_default = 262144" | sudo tee -a /etc/sysctl.conf
echo "net.core.rmem_max = 16777216" | sudo tee -a /etc/sysctl.conf
echo "net.core.wmem_default = 262144" | sudo tee -a /etc/sysctl.conf
echo "net.core.wmem_max = 16777216" | sudo tee -a /etc/sysctl.conf

Apply the changes:

sudo sysctl -p

Troubleshooting Common Issues

Package Dependency Conflicts

Dependency conflicts frequently occur when mixing different repositories or installation methods. Resolve conflicts by identifying problematic packages:

sudo apt-get check

Remove conflicting packages before attempting reinstallation:

sudo apt remove --purge erlang*
sudo apt autoremove
sudo apt autoclean

Clear package cache and reconfigure repositories:

sudo rm -rf /var/lib/apt/lists/*
sudo apt update

Compilation Errors and Solutions

Source compilation errors typically result from missing development headers or incompatible library versions. Common SSL-related errors require OpenSSL development packages:

sudo apt install libssl-dev

Graphics-related compilation failures need additional X11 development libraries:

sudo apt install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxinerama-dev libxi-dev libxcursor-dev libgl1-mesa-dev libglu1-mesa-dev

Memory exhaustion during compilation requires reducing parallel jobs:

make -j1

Permission and Path Issues

Path configuration problems prevent finding Erlang executables. Verify your PATH contains Erlang binary directories:

echo $PATH | grep erlang

Add missing directories to your shell configuration:

echo 'export PATH="/usr/local/bin:/usr/bin:$PATH"' >> ~/.bashrc

Permission errors during installation require proper sudo privileges or alternative installation locations:

./configure --prefix=$HOME/erlang
make install

Maintenance and Updates

Updating Erlang Installations

Package-based installations update through standard system maintenance:

sudo apt update && sudo apt upgrade

Source-based installations require manual updates. Download newer versions and repeat the compilation process, optionally preserving configuration:

make clean
./configure --prefix=/usr/local --enable-threads --enable-smp-support
make -j$(nproc) && sudo make install

Version managers simplify updates through built-in commands:

kerl update releases
kerl build 26.1.0 erlang_26.1.0
kerl install erlang_26.1.0 ~/erlang/26.1.0

Uninstalling Erlang

Clean removal procedures vary by installation method. Package installations use standard removal commands:

sudo apt remove --purge erlang* esl-erlang
sudo apt autoremove

Source installations require manual removal:

sudo rm -rf /usr/local/lib/erlang
sudo rm -f /usr/local/bin/erl /usr/local/bin/erlc /usr/local/bin/escript

Version manager installations delete through manager commands:

kerl delete installation ~/erlang/26.0.2
kerl delete build erlang_26.0.2

Security Considerations

Package Verification and Integrity

Always verify package signatures when installing from external repositories. GPG key verification prevents malicious package installation:

gpg --verify package.sig package.tar.gz

Use official repositories whenever possible, avoiding unofficial or untrusted sources. Repository priorities prevent accidental installation from lower-quality sources:

echo 'Package: *
Pin: origin packages.erlang-solutions.com
Pin-Priority: 1000' | sudo tee /etc/apt/preferences.d/erlang-solutions

Runtime Security Configurations

Configure Erlang applications with appropriate security settings. Disable unnecessary network services and restrict file system access:

{kernel, [
    {inet_dist_use_interface, {127,0,0,1}},
    {inet_dist_listen_min, 9100},
    {inet_dist_listen_max, 9105}
]}

Implement proper authentication and authorization mechanisms for distributed Erlang applications. Use SSL/TLS encryption for network communications between nodes.

Advanced Installation Considerations

Docker and Containerization

Modern deployment strategies often utilize containerization. Create Dockerfile templates for consistent Erlang environments:

FROM debian:13-slim
RUN apt-get update && apt-get install -y \
    erlang \
    && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY . .
CMD ["erl"]

Container-based installations provide reproducible environments across development, testing, and production systems.

Cross-Platform Compatibility

Erlang’s cross-platform nature requires consideration of architecture-specific optimizations. ARM-based systems benefit from specific compilation flags:

./configure --host=aarch64-linux-gnu --build=x86_64-linux-gnu

Ensure proper library paths and dependencies for target architectures when cross-compiling or deploying to different hardware platforms.

Congratulations! You have successfully installed Erlang. Thanks for using this tutorial for installing the latest version of Erlang on Debian 13 “Trixie”. 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