Linux MintUbuntu Based

How To Install Erlang on Linux Mint 22

Install Erlang on Linux Mint 22

Erlang stands as one of the most powerful concurrent programming languages designed for building fault-tolerant, distributed systems. Originally developed by Ericsson for telecommunications applications, this functional programming language has found its way into banking systems, e-commerce platforms, instant messaging services, and real-time applications worldwide. Linux Mint 22, with its Ubuntu-based foundation, provides an excellent platform for running Erlang applications, offering stability and comprehensive package support.

This comprehensive guide walks you through multiple installation methods for Erlang on Linux Mint 22. Whether you’re a seasoned developer, system administrator, or student exploring concurrent programming, you’ll find detailed instructions covering repository-based installations, source compilation, and version management tools. Each method addresses different use cases, from quick setups to custom configurations requiring specific Erlang versions.

Table of Contents

Prerequisites and System Preparation

System Requirements

Before installing Erlang on Linux Mint 22, verify your system meets the basic requirements. Linux Mint 22 inherits Ubuntu’s robust package management system, ensuring excellent compatibility with Erlang installations. Check your system version using the terminal command:

lsb_release -a

This command displays your Linux Mint version and underlying Ubuntu base. Your system should have at least 2GB of RAM and 1GB of available disk space for a complete Erlang/OTP installation. Administrative privileges through sudo access are essential for system-wide installations.

Essential Dependencies

Successful Erlang installation requires several development packages and build tools. Update your package repositories first:

sudo apt update

Install the fundamental build tools and dependencies:

sudo apt install build-essential autoconf git curl wget

For complete Erlang functionality, install additional development libraries:

sudo apt install libssl-dev libncurses-dev libwxgtk3.0-gtk3-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev

These packages ensure proper SSL support, terminal interface functionality, and GUI application compatibility. The OpenGL libraries enable graphics-intensive Erlang applications, while PNG support handles image processing requirements.

Preparing the Development Environment

Create a dedicated workspace directory for Erlang-related projects:

mkdir -p ~/erlang-workspace
cd ~/erlang-workspace

Consider setting up environment variables in your shell configuration file (~/.bashrc or ~/.zshrc) for consistent development experiences across terminal sessions.

Installation Method 1: Using Official Erlang Solutions Repository

Overview of Erlang Solutions Repository

The Erlang Solutions repository provides the most straightforward installation path, offering pre-compiled packages optimized for Ubuntu-based distributions. This method ensures automatic security updates and simplified maintenance through your system’s package manager. The repository maintains multiple Erlang versions, allowing you to choose between stable releases and cutting-edge features.

Step-by-Step Installation Process

Begin by downloading the repository configuration package:

wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb

Install the repository package to add Erlang Solutions to your system’s package sources:

sudo dpkg -i erlang-solutions_1.0_all.deb

Update your package cache to recognize the new repository:

sudo apt update

Install Erlang with all recommended components:

sudo apt install erlang

This command installs the complete Erlang/OTP platform, including the runtime system, standard libraries, and development tools.

Repository Configuration Details

The installation process automatically configures your system’s package sources. Linux Mint 22 users benefit from Ubuntu’s package compatibility, ensuring seamless integration with existing system packages. The repository configuration file appears in /etc/apt/sources.list.d/erlang-solutions.list, containing the appropriate distribution codename.

For manual configuration or troubleshooting, verify the repository entry matches your system’s Ubuntu base. Linux Mint 22 typically corresponds to Ubuntu 22.04 (Jammy), requiring the appropriate repository URL format.

Verification and Testing

Launch the Erlang shell to verify successful installation:

erl

The Erlang shell displays version information and system details upon startup. Test basic functionality with a simple calculation:

1> 2 + 3.
5
2> halt().

Create a simple “Hello World” program to test compilation capabilities:

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

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

Compile and run the program:

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

Successful execution confirms your Erlang installation functions correctly.

Installation Method 2: Using RabbitMQ PPA

Understanding PPAs for Erlang Installation

Personal Package Archives (PPAs) provide alternative package sources maintained by specific organizations or communities. The RabbitMQ team maintains a high-quality Erlang PPA, offering regularly updated packages optimized for Ubuntu-based systems. This approach provides newer versions than standard repositories while maintaining package management benefits.

Installation Steps Using RabbitMQ PPA

Add the RabbitMQ Erlang PPA to your system:

sudo add-apt-repository ppa:rabbitmq/rabbitmq-erlang

The system prompts for confirmation before adding the repository. Press Enter to continue, then update your package lists:

sudo apt update

Install Erlang from the PPA:

sudo apt install erlang

This installation method provides recent Erlang versions with excellent Ubuntu compatibility.

PPA Management and Maintenance

Monitor PPA updates regularly to maintain security and functionality. Upgrade your Erlang installation with standard package management commands:

sudo apt upgrade erlang

If you need to remove the PPA later, use the ppa-purge utility:

sudo apt install ppa-purge
sudo ppa-purge ppa:rabbitmq/rabbitmq-erlang

This command safely removes the PPA and reverts packages to official repository versions.

Installation Method 3: Compiling from Source Code

When to Choose Source Compilation

Source compilation offers maximum flexibility and access to the latest Erlang features before they appear in package repositories. This method suits developers requiring specific configurations, custom optimizations, or bleeding-edge functionality. However, source compilation requires more time and technical expertise compared to package-based installations.

Downloading and Preparing Source Code

Download the latest Erlang/OTP source code from the official website:

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

Extract the source archive:

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

Set the ERL_TOP environment variable to reference the source directory:

export ERL_TOP=$(pwd)

This variable helps the build system locate necessary files during compilation.

Configuration and Build Process

Configure the build system with your preferred options:

./configure --prefix=/opt/erlang/28.0.2

The prefix option specifies the installation directory. Some systems require explicit locale configuration to prevent character encoding issues:

export LANG=C
./configure --prefix=/opt/erlang/28.0.2

Compile Erlang using multiple processor cores for faster builds:

make -j$(nproc)

The compilation process takes 15-30 minutes depending on your system’s performance.

Installation and Setup

Install the compiled Erlang system:

sudo make install

Create symbolic links for system-wide access:

sudo ln -s /opt/erlang/28.0.2/bin/erl /usr/local/bin/erl
sudo ln -s /opt/erlang/28.0.2/bin/erlc /usr/local/bin/erlc

Add the installation directory to your PATH by editing ~/.bashrc:

echo 'export PATH="/opt/erlang/28.0.2/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Troubleshooting Source Compilation

Common compilation errors often relate to missing dependencies. Ensure all required development packages are installed before attempting compilation. Memory constraints can cause build failures on systems with limited RAM. Consider using swap space or reducing parallel compilation jobs:

make -j2

Platform-specific issues may require additional configure flags. Consult the INSTALL file in the source directory for detailed configuration options and troubleshooting guidance.

Installation Method 4: Using Package Managers (asdf/kerl)

Introduction to Version Managers

Version managers like asdf and kerl provide sophisticated tools for managing multiple Erlang installations simultaneously. These utilities excel in development environments requiring different Erlang versions for various projects. However, some compatibility issues have been reported with Linux Mint 22, requiring careful configuration.

Installing with asdf

Install asdf using the official installation script:

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0

Add asdf to your shell configuration:

echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc
source ~/.bashrc

Add the Erlang plugin:

asdf plugin-add erlang

List available Erlang versions:

asdf list-all erlang

Install a specific Erlang version:

asdf install erlang 28.0.2

Set the global Erlang version:

asdf global erlang 28.0.2

Installing with kerl

Kerl provides another approach to Erlang version management. Download and install kerl:

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

Build and install an Erlang version:

kerl build 28.0.2 28.0.2
kerl install 28.0.2 ~/erlang/28.0.2

Activate the installation:

source ~/erlang/28.0.2/activate

Troubleshooting Version Managers

Linux Mint 22 users may encounter compatibility issues with certain version managers. These problems often stem from dependency conflicts or incomplete shell integration. Ensure your development dependencies are current and consider using virtual environments to isolate Erlang installations from system packages.

Post-Installation Configuration and Verification

Verifying Installation Success

Test your Erlang installation thoroughly to ensure all components function correctly. Launch the Erlang shell:

erl

Check version information and system capabilities:

1> erlang:system_info(system_version).

Exit the shell and test the compiler:

erlc --help

This command should display compiler options and usage information.

Environment Configuration

Configure your development environment for optimal Erlang usage. Add Erlang-specific environment variables to your shell configuration:

export ERL_LIBS="$HOME/erlang-libs"
export EDITOR="nano"

The ERL_LIBS variable specifies additional library search paths, while EDITOR sets your preferred text editor for Erlang development tools.

Basic Functionality Testing

Create a comprehensive test module to verify Erlang functionality:

-module(test_installation).
-export([run_tests/0]).

run_tests() ->
    test_arithmetic(),
    test_processes(),
    test_io(),
    io:format("All tests passed successfully!~n").

test_arithmetic() ->
    5 = 2 + 3,
    6 = 2 * 3,
    ok.

test_processes() ->
    Pid = spawn(fun() -> receive stop -> ok end end),
    is_pid(Pid) = true,
    Pid ! stop,
    ok.

test_io() ->
    ok = io:format("Testing I/O functionality~n"),
    ok.

Compile and run the test module:

erlc test_installation.erl
erl -noshell -s test_installation run_tests -s init stop

Performance and System Integration

Monitor Erlang’s memory usage and system integration after installation. Use system monitoring tools to verify resource consumption remains within acceptable limits. Configure system-level limits for Erlang processes if necessary, particularly in production environments handling high concurrent loads.

Common Installation Issues and Troubleshooting

Repository and Network Issues

Network connectivity problems can interrupt repository-based installations. Configure package manager proxies if your network requires them:

echo 'Acquire::http::Proxy "http://proxy.example.com:8080";' | sudo tee /etc/apt/apt.conf.d/proxy.conf

GPG key verification failures indicate repository authentication issues. Manually import Erlang Solutions’ GPG key:

wget -O- https://packages.erlang-solutions.com/erlang_solutions.asc | sudo apt-key add -

Dependency Resolution Problems

Missing build dependencies cause compilation failures during source builds. Install the complete development toolchain:

sudo apt install build-essential autotools-dev libncurses5-dev openssl libssl-dev fop xsltproc unixodbc-dev libsctp-dev

Version conflicts between system packages and Erlang requirements may require package pinning or alternative installation methods.

Compilation and Build Errors

Configure script failures often indicate missing development libraries or incompatible system configurations. Review the config.log file for detailed error information:

less config.log

Memory exhaustion during compilation affects systems with limited RAM. Increase swap space or reduce compilation parallelism:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Permission and Access Issues

Installation permission problems require careful attention to file ownership and access rights. Avoid running installations as root unless absolutely necessary. Use sudo selectively for system-wide installations while maintaining user ownership of development directories.

Version Compatibility Problems

Erlang version requirements vary between applications and frameworks. Check application documentation for supported Erlang versions before installation. OTP version compatibility matrices help identify suitable Erlang releases for specific use cases.

System-Specific Troubleshooting

Linux Mint 22 inherits Ubuntu’s package management system but may exhibit unique characteristics affecting Erlang installations. Virtual machine deployments sometimes require additional configuration for optimal performance. Container environments need careful attention to resource limits and process isolation.

Best Practices and Optimization

Installation Best Practices

Choose installation methods based on your specific requirements and maintenance preferences. Repository-based installations provide automatic updates and simplified management, while source compilation offers customization flexibility. Document your installation choices and configurations for future reference and team collaboration.

Test installations in isolated environments before deploying to production systems. Virtual machines or containers provide safe spaces for experimentation without affecting critical systems.

Performance Optimization

Configure Erlang runtime parameters for optimal performance in your specific environment. Adjust scheduler counts, memory allocation strategies, and garbage collection settings based on application requirements:

erl +S 4:4 +A 10 +K true

These flags configure scheduler threads, async threads, and kernel polling for improved performance under high concurrency loads.

Security Considerations

Verify package integrity using GPG signatures and checksums when installing from repositories or source archives. Keep Erlang installations updated with security patches and bug fixes. Restrict file permissions on Erlang installations and associated configuration files.

Monitor system logs for unusual Erlang process behavior or resource consumption patterns that might indicate security issues or misconfigurations.

Maintenance and Updates

Establish regular update schedules for Erlang installations, balancing security requirements with stability needs. Test updates in development environments before applying them to production systems. Maintain rollback procedures for critical installations requiring rapid recovery from problematic updates.

Alternative Installation Methods and Tools

Docker and Container Solutions

Docker provides isolated Erlang environments with consistent configurations across different host systems. Official Erlang Docker images offer pre-configured installations:

docker run -it erlang:28

Custom Dockerfiles enable specialized configurations tailored to specific application requirements. Container orchestration platforms like Kubernetes facilitate scalable Erlang application deployments.

Snap and Flatpak Packages

Universal package formats provide alternative installation paths with built-in dependency management and sandboxing features. While Erlang availability in these formats remains limited, they offer potential solutions for specific deployment scenarios requiring application isolation.

Third-Party Installation Scripts

Community-maintained installation scripts automate complex installation procedures. Exercise caution when using third-party scripts, verifying their authenticity and reviewing their contents before execution. Automated tools can simplify installations but may introduce unexpected system modifications.

IDE and Development Environment Integration

Modern integrated development environments provide Erlang support through plugins and extensions. Visual Studio Code offers comprehensive Erlang development capabilities through the Erlang LS extension. IntelliJ IDEA supports Erlang development through dedicated plugins providing syntax highlighting, debugging, and project management features.

Vim and Emacs users can leverage specialized Erlang modes for enhanced editing experiences. These editors provide syntax highlighting, indentation management, and compilation integration for efficient Erlang development workflows.

Congratulations! You have successfully installed Erlang. Thanks for using this tutorial for installing the latest version of Erlang on Linux Mint 22. 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