Erlang is a robust programming language used for building large-scale real-time applications which require high availability. In this article, we will look at how to install Erlang in Ubuntu. You can also use these steps to install Erlang in other Debian Linux systems.
How to Install Erlang in Ubuntu
Here are the steps to install Erlang in Ubuntu.
1. Add Erlang Repository
Open terminal and run the following command to add erlang repository to your system.
$ sudo wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb $ sudo dpkg -i erlang-solutions_1.0_all.deb
Also read : How to Change User Password in Linux
2. Update Ubuntu
Update Ubuntu packages
$ sudo apt-get update
Also read : How to Install Fail2ban in Ubuntu
3. Install Erlang
Run the following command to install Erlang in Ubuntu.
$ sudo apt-get install erlang
Alternatively, if you want to do a complete installation of Erlang including OTP, then run the following command.
$ sudo apt-get install esl-erlang
Also read : How to find top CPU consuming processes in Linux
4. Test Erlang
Let’s create a simple script to test our installation. Create an empty .erl file
$ sudo vi helloworld.erl
Add the following code to it.
% hello world program -module(helloworld). -export([start/0]). start() -> io:fwrite("Hello World!\n").
Compile the above script with the following command. It will create helloworld.beam file.
$ sudo erlc helloworld.erl
Run the program with the following command.
$ sudo erl -noshell -s helloworld start -s init stop
Also read : How to Open Port in Linux
If you want to remove Erlang from your system just run the following commands.
$ sudo apt remove erlang $ sudo apt autoremove
That’s it. As you can see it is very easy to install Erlang in Ubuntu. If you work with erlang, you might also be interested in reading How to install RabbitMQ in Ubuntu.