Erlang is a functional programming language used to build large-scale and scalable real-time systems. Erlang was originally a proprietary software created by Ericsson and was later open sourced. |
Erlang is available in the Universe repository of Ubuntu. After enabling the repository, you can easily install it using the following command :
sudo apt install erlang
However, the Erlang version provided in the Ubuntu repository may not be the latest .
If you want the latest Erlang version on Ubuntu, you can add the repository provided by Erlang Solutions. They provide pre-compiled binaries for various Linux distributions, Windows and macOS.
If you have previously installed a package called erlang, it will be upgraded to a newer version provided by the added repository.
Install the latest version of Erlang on Ubuntu
You need to download the key file in the Linux terminal. You can use the wget tool, so make sure you have it installed:
sudo apt install wget
Next, use wget to download the GPG key of the Erlang Solution warehouse and add it to your apt packaging system. After adding the key, your system will trust the package from that repository.
wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo apt-key add -
Now, you should add a file for Erlang in your APT sources.list.d directory. This file will contain information about the repository, and the APT package manager will use it to get packages and future updates.
For Ubuntu 20.04 (and Ubuntu 20.10), use the following command :
echo "deb https://packages.erlang-solutions.com/ubuntu focal contrib" | sudo tee /etc/apt/sources.list.d/erlang-solution.list
I know that the above command mentioned Ubuntu 20.04 focal, but it also applies to Ubuntu 20.10 groovy.
For Ubuntu 18.04 , use the following command:
echo "deb https://packages.erlang-solutions.com/ubuntu bionic contrib" | sudo tee /etc/apt/sources.list.d/erlang-solution.list
You must update the local package cache to notify it about newly added packages in the warehouse.
sudo apt update
You will notice that it recommends you to perform some upgrades. If you list the available upgrades, you will find the erlang package there. To update the existing erlang version or reinstall, use this command:
sudo apt install erlang
After installation, you can test it.
To exit the Erlang shell , use Ctrl+g, and then type q. Since I have never used Erlang before, I had to try some keystrokes and then found out how to do it.
Delete erlang
To delete the program, use the following command:
sudo apt remove erlang
There will also be some dependencies. You can delete them with the following command:
sudo apt autoremove
If you want, you can also delete the added warehouse file.
sudo rm /etc/apt/sources.list.d/erlang-solution.list
That's it. Enjoy learning and coding with Erlang on Ubuntu Linux.