{"id":11749,"date":"2022-03-01T22:35:23","date_gmt":"2022-03-01T19:35:23","guid":{"rendered":"https:\/\/kifarunix.com\/?p=11749"},"modified":"2024-03-09T11:17:10","modified_gmt":"2024-03-09T08:17:10","slug":"install-erlang-on-ubuntu","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-erlang-on-ubuntu\/","title":{"rendered":"Install Erlang on Ubuntu 22.04\/Ubuntu 20.04"},"content":{"rendered":"\n<p>This tutorial provides a step-by-step guide on how to install Erlang on Ubuntu 22.04\/Ubuntu 20.04. According to <a href=\"https:\/\/www.erlang.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">erlang.org<\/a>, Erlang <em>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&#8217;s runtime system has built-in support for concurrency, distribution and fault tolerance. <\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install Erlang on Ubuntu 22.04\/Ubuntu 20.04<\/h2>\n\n\n\n<p>There are two way to install Erlang:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"#use-prebuilt-binaries\">Install Erlang using Prebuilt binaries<\/a><\/li>\n\n\n\n<li><a href=\"#compile-from-source\">Install Erlang by compiling from the source<\/a><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"use-prebuilt-binaries\">Install Erlang using Prebuilt binaries<\/h3>\n\n\n\n<p>The default Ubuntu repositories provides Erlang packages. However, the available packages may not be up-to-date.<\/p>\n\n\n\n<p>Erlang\/OTP 24.2.2 is the the current release versions as of this writing.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"erlang-ubuntu-22.04\"><a href=\"#erlang-ubuntu-22.04\">Install Erlang on Ubuntu 22.04 using Prebuilt binaries<\/a><\/h4>\n\n\n\n<p>The default Ubuntu 22.04 repos provides version 24.2.1;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-cache policy erlang<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>erlang:\n  Installed: (none)\n  Candidate: 1:24.2.1+dfsg-1\n  Version table:\n     1:24.2.1+dfsg-1 500\n        500 http:\/\/ke.archive.ubuntu.com\/ubuntu jammy\/universe amd64 Packages\n<\/code><\/pre>\n\n\n\n<p>Thus, if you want to install Erlang on Ubuntu 22.04 using the prebuild binary, run the command below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install erlang<\/code><\/pre>\n\n\n\n<p>The Erlang distribution also includes OTP (Open Telecom Platform) which provides a rich set of libraries and applications.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"erlang-ubuntu-20.04\"><a href=\"#erlang-ubuntu-20.04\">To install Erlang on Ubuntu 20.04 using Prebuilt binaries<\/a><\/h4>\n\n\n\n<p>To install latest release version of Erlang on Ubuntu 20.04, you first need to install the Erlang repository as follows;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/packages.erlang-solutions.com\/erlang-solutions_2.0_all.deb<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install .\/erlang-solutions_2.0_all.deb<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install erlang<\/code><\/pre>\n\n\n\n<p>Similarly, the Erlang distribution also includes OTP (Open Telecom Platform) which provides a rich set of libraries and applications.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"compile-from-source\">Install Erlang by Compiling from the source<\/h3>\n\n\n\n<p>If you want to run the latest version of Erlang on Ubuntu 22.04\/Ubuntu 20.04, then you can build it from the source.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install Required Build Utilities<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install zip libncurses-dev sed git tar make gcc perl openssl flex bison default-jdk libssl-dev unixodbc-dev libwxgtk3.0-gtk3-dev libwxgtk-webview3.0-gtk3-dev libglu1-mesa-dev fop xsltproc libxml2-utils apache2<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Download Erlang Source Code<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>VER=24.2.2<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/github.com\/erlang\/otp\/releases\/download\/OTP-$VER\/otp_src_$VER.tar.gz<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Extract the Source code<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>tar xzf otp_src_$VER.tar.gz<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Configure, build and install Erlang;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>cd otp_src_$VER<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>export ERL_TOP=`pwd`<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/configure<\/code><\/pre>\n\n\n\n<p>Before you can proceed, ensure that the configure script above returns no error.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make<\/code><\/pre>\n\n\n\n<p>Run smoke test to ensure the build is successful;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make release_tests<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>cd release\/tests\/test_server<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>~\/otp_src_24.2.2\/bin\/erl -s ts install -s ts smoke_test batch -s init stop<\/code><\/pre>\n\n\n\n<p>Next, access <code><strong>$ERL_TOP\/release\/tests\/test_server\/index.html<\/strong><\/code>&nbsp;in your web browser and make sure that there are zero failed test cases.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rsync -avP ~\/otp_src_24.2.2 \/var\/www\/html\/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sed -i 's|\/var\/www\/html|\/var\/www\/html\/otp_src_24.2.2\/release\/tests\/test_server\/|' \/etc\/apache2\/sites-available\/000-default.conf<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>chown -R www-data: \/var\/www\/html\/otp_src_24.2.2\/release\/tests\/test_server<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart apache2<\/code><\/pre>\n\n\n\n<p>Access the Web Server, http:\/\/&lt;server-IP&gt;.<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/03\/erlang-test-results.png\" class=\"td-modal-image\"><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1734\" height=\"926\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/03\/erlang-test-results.png\" alt=\"Install Erlang on Ubuntu 22.04\/Ubuntu 20.04\" class=\"wp-image-11751\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/03\/erlang-test-results.png?v=1646160572 1734w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/03\/erlang-test-results-768x410.png?v=1646160572 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/03\/erlang-test-results-1536x820.png?v=1646160572 1536w\" sizes=\"(max-width: 1734px) 100vw, 1734px\" \/><\/figure><\/div><\/a><\/div>\n\n\n\n<p>Install Erlang from Source on Ubuntu 22.04\/Ubuntu 20.04 if all well from the test above.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\/otp_src_24.2.2\/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>make install<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Using Erlang<\/h2>\n\n\n\n<p>You can now start using Erlang language for your programming.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>erl<\/code><\/pre>\n\n\n\n<p>Check current working directory by running the command <strong>pwd().<\/strong>;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>Erlang\/OTP 24 [erts-12.2.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit]\n\nEshell V12.2.1  (abort with ^G)\n1&gt; <strong>pwd().<\/strong>\n\/home\/kifarunix\nok\n2&gt;\n<\/code><\/pre>\n\n\n\n<p>You can now start writing your projects in specific directories. For example in the above, I am working from <strong><code>\/home\/kifarunix<\/code><\/strong> directory.<\/p>\n\n\n\n<p>Creating an Hello World program;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>cat &gt; hello_world.erl &lt;&lt; 'EOL'\n-module(hello_world).\n   -export([hello_world\/0]).\n\nhello_world() -&gt;\n    io:fwrite(\"hello world\\n\").\nEOL\n<\/code><\/pre>\n\n\n\n<p>Next, execute the program;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>erl<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>Erlang\/OTP 24 [erts-12.2.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit]\n\nEshell V12.2.1  (abort with ^G)\n1&gt; pwd().\n\/home\/kifarunix\nok\n2&gt; c(hello_world).\n{ok,hello_world}\n3&gt; hello_world:hello_world().\nhello world\nok\n4&gt;\n<\/code><\/pre>\n\n\n\n<p>You can check further examples on <a href=\"https:\/\/erlangbyexample.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Erlang by Example<\/a>.<\/p>\n\n\n\n<p>Read more on the <a href=\"https:\/\/www.erlang.org\/docs\/24\/\" target=\"_blank\" rel=\"noreferrer noopener\">documentation page<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Other Tutorials<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-rabbitmq-on-ubuntu\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install RabbitMQ on Ubuntu 22.04\/Ubuntu 20.04<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-gvm-21-04-on-debian-11-debian-10\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install GVM 21.04 on Debian 11\/Debian 10<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-processwire-on-ubuntu\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install ProcessWire on Ubuntu 22.04<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial provides a step-by-step guide on how to install Erlang on Ubuntu 22.04\/Ubuntu 20.04. According to erlang.org, Erlang is a programming language used to<\/p>\n","protected":false},"author":1,"featured_media":11752,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121],"tags":[4658,4654,4656,4657,4653,4655],"class_list":["post-11749","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-erlang","tag-install-erlang-ubuntu","tag-install-erlang-ubuntu-20-04","tag-install-erlang-ubuntu-22-04","tag-rabbitmq-erlang","tag-ubuntu-erlang-install","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/11749"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=11749"}],"version-history":[{"count":8,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/11749\/revisions"}],"predecessor-version":[{"id":20450,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/11749\/revisions\/20450"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/11752"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=11749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=11749"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=11749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}