In this article we will perform the installation of Erlang on Ubuntu 24.04. Erlang is a functional and high-level programming language designed for building scalable system with focus on fault-tolerance. Erlang is a perfect solution for handling higher number concurrent connections. It is widely used in building powerful e-commerce and online payment applications. Erlang has a steeper learning curve in comparison to Java or Python.
Add Erlang repository
Update packages list and add basic dependencies into the system.
sudo apt update
sudo apt install software-properties-common curl apt-transport-https lsb-release
Once this has been done, we proceed to add Erlang repository into the system.
curl -1sLf 'https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/setup.deb.sh' | sudo -E bash
The output looks like below.
Executing the setup script for the 'rabbitmq/rabbitmq-erlang' repository ...
OK: Checking for required executable 'curl' ...
OK: Checking for required executable 'apt-get' ...
OK: Detecting your OS distribution and release using system methods ...
^^^^: ... Detected/provided for your OS/distribution, version and architecture:
>>>>:
>>>>: ... distro=ubuntu version=24.04 codename=noble arch=x86_64
>>>>:
OK: Checking for apt dependency 'apt-transport-https' ...
OK: Checking for apt dependency 'ca-certificates' ...
OK: Checking for apt dependency 'gnupg' ...
OK: Checking for apt signed-by key support ...
OK: Importing 'rabbitmq/rabbitmq-erlang' repository GPG keys ...
OK: Checking if upstream install config is OK ...
OK: Installing 'rabbitmq/rabbitmq-erlang' repository via apt ...
OK: Updating apt repository metadata cache ...
OK: The repository has been installed successfully - You're ready to rock!
Confirm it’s added successfully.
sudo apt update
Install Erlang on Ubuntu 24.04
With the repository added you can proceed with the installation of Erlang on Ubuntu 24.04 Linux system.
sudo apt install erlang
Proceed with the installation as prompted.
0 upgraded, 239 newly installed, 0 to remove and 0 not upgraded.
Need to get 206 MB of archives.
After this operation, 800 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
To initiate Erlang shell, run below.
$ erl
Erlang/OTP 26 [erts-14.2.4] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [jit:ns]
Eshell V14.2.4 (press Ctrl+G to abort, type help(). for help)
1> ^G
--> q
Create Erlang sample application
Create an hello world erlang program.
tee sample.erl<<EOF
% Sample Erlang Program program
-module(sample).
-export([start/0]).
start() ->
io:fwrite("Hello, world!~n").
EOF
Compile erlang module by executing the following commands in your terminal.
erlc sample.erl
Start an Erlang shell:
erl
Next load compiled Erlang module:
1> c(sample).
{ok,sample}
Run the program.
2> sample:start().
Hello, world!
ok
You should see below in the output:
Hello, world!
Conclusion
To summarize, Erlang perfect fit for developing fault-tolerant applications. If you need real-time processing, then this programming language is fit for you. Erlang is also a great choice when the desire is to have scalable applications. For more questions and understanding, read Erlang documentation pages.