On this short tutorial, we will learn how to install Erlang on Ubuntu 20.04 LTS operating system.
Introduction
Erlang is a functional, general-purpose, concurrent programming language and garbage-collected runtime environment supported and maintained by Ericsson OTP product unit.
From the Erlang’s official website, we can get information if Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang’s runtime system has built-in support for concurrency, distribution and fault tolerance.
Erlang programming language was built for concurrency, fault tolerance, and distributed application architectures. OTP (Open Telecom Platform) is a collection of libraries and middleware for Erlang. This guide will show you how you can install and use the latest release of Erlang/OTP on Ubuntu 20.04 | 18.04 LTS.
Erlang Installation steps will be performed by several steps as shown below :
- Adding Erlang Repository
- Install Erlang on Ubuntu 20.04
- Test Erlang With Hello World Program
Adding Erlang Repository
Erlang repository is not include on Ubuntu 20.04 repository system, so we have to add it first to install Erlang on our Ubuntu 20.04 LTS operating system. On this step we will import Erlang Erlang GPG Key and add it tor Ubuntu repository.
1. Import Erlang GPG Key
$ wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo apt-key add -
Output :
ramans@otodiginet:~$ wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo apt-key add - --2020-12-03 20:23:13-- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc Resolving packages.erlang-solutions.com (packages.erlang-solutions.com)... 13.32.168.77 Connecting to packages.erlang-solutions.com (packages.erlang-solutions.com)|13.32.168.77|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 3133 (3.1K) [text/plain] Saving to: ‘STDOUT’ - 100%[==============================================>] 3.06K --.-KB/s in 0s 2020-12-03 20:23:33 (9.98 MB/s) - written to stdout [3133/3133]
2. Add Erlang Repository to Ubuntu
$ echo "deb https://packages.erlang-solutions.com/ubuntu focal contrib" | sudo tee /etc/apt/sources.list.d/rabbitmq.list
Output :
ramans@otodiginet:~$ echo "deb https://packages.erlang-solutions.com/ubuntu focal contrib" | sudo tee /etc/apt/sources.list.d/rabbitmq.list deb https://packages.erlang-solutions.com/ubuntu focal contrib
Install Erlang on Ubuntu 20.04
After adding Erlang repository to our Ubuntu system, then we will install it by submitting command line :
$ sudo apt update $ sudo apt install erlang
Output :
ramans@otodiginet:~$ sudo apt install erlang [sudo] password for ramans: Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: erlang-appmon erlang-asn1 erlang-base erlang-common-test erlang-crypto erlang-debugger erlang-dev erlang-dialyzer erlang-diameter erlang-edoc erlang-eldap erlang-erl-docgen erlang-et erlang-eunit erlang-examples erlang-ftp erlang-gs erlang-ic erlang-ic-java erlang-inets erlang-inviso erlang-jinterface erlang-megaco erlang-mnesia erlang-mode erlang-observer erlang-odbc erlang-os-mon erlang-parsetools erlang-percept erlang-pman erlang-public-key erlang-reltool erlang-runtime-tools erlang-snmp erlang-src erlang-ssh erlang-ssl erlang-syntax-tools erlang-test-server erlang-tftp erlang-toolbar erlang-tools erlang-tv erlang-typer erlang-wx erlang-xmerl libodbc1 libwxbase3.0-0v5 libwxgtk3.0-gtk3-0v5 tcl tcl8.6 tk tk8.6 Suggested packages: erlang-manpages erlang-doc xsltproc fop libmyodbc odbc-postgresql tdsodbc unixodbc-bin tcl-tclreadline The following NEW packages will be installed: erlang erlang-appmon erlang-asn1 erlang-base erlang-common-test erlang-crypto erlang-debugger erlang-dev erlang-dialyzer erlang-diameter erlang-edoc erlang-eldap erlang-erl-docgen erlang-et erlang-eunit erlang-examples erlang-ftp erlang-gs erlang-ic erlang-ic-java erlang-inets erlang-inviso erlang-jinterface erlang-megaco erlang-mnesia erlang-mode erlang-observer erlang-odbc erlang-os-mon erlang-parsetools erlang-percept erlang-pman erlang-public-key erlang-reltool erlang-runtime-tools erlang-snmp erlang-src erlang-ssh erlang-ssl erlang-syntax-tools erlang-test-server erlang-tftp erlang-toolbar erlang-tools erlang-tv erlang-typer erlang-wx erlang-xmerl libodbc1 libwxbase3.0-0v5 libwxgtk3.0-gtk3-0v5 tcl tcl8.6 tk tk8.6 0 upgraded, 55 newly installed, 0 to remove and 356 not upgraded. Need to get 44.5 MB/45.5 MB of archives. After this operation, 133 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 libwxgtk3.0-gtk3-0v5 amd64 3.0.4+dfsg-15build1 [4,359 kB] Get:2 https://packages.erlang-solutions.com/ubuntu focal/contrib amd64 erlang-base amd64 1:23.1-1 [9,579 kB] Get:3 https://packages.erlang-solutions.com/ubuntu focal/contrib amd64 erlang-dev amd64 1:23.1-1 [310 kB] ... Setting up erlang-common-test (1:23.1-1) ... Setting up erlang (1:23.1-1) ... Processing triggers for libc-bin (2.31-0ubuntu9) ... Processing triggers for man-db (2.9.1-1) ...
Until this stage, we have installed Erlang successfully on Ubunu 20.04 LTS, then we will try to make a simple interaction Erlang application.
To enter to Erlang shell, we just submit the erl command line, as shown below.
$ erl
Output :
ramans@otodiginet:~$ erl Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] Eshell V11.1 (abort with ^G)
We will take an interactive math operation on Erlang shell, as shown below :
ramans@otodiginet:~$ erl Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] Eshell V11.1 (abort with ^G) 1> 4 + 8. 12 2> (42 + 77) * 66 / 3. 2618.0 3> (4 + 3) * 4 / 4. 7.0 4> BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution a
Conlusion
On this tutorial, we have learnt how to install and create a simple Anacd
Pingback: How To Install RabbitMQ Server On Ubuntu 20.04 LTS - bckinfo.com