{"id":11768,"date":"2022-03-09T20:43:12","date_gmt":"2022-03-09T17:43:12","guid":{"rendered":"https:\/\/kifarunix.com\/?p=11768"},"modified":"2024-03-09T11:12:13","modified_gmt":"2024-03-09T08:12:13","slug":"install-erlang-on-debian","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-erlang-on-debian\/","title":{"rendered":"Install Erlang on Debian 11\/Debian 10"},"content":{"rendered":"\n
This tutorial provides a step-by-step guide on how to install Erlang on Debian 11\/Debian 10. According to erlang.org<\/a>, 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. <\/em><\/p>\n\n\n\n There are different ways in which you can install Erlang on Debian;<\/p>\n\n\n\n The default debian repositories provides Erlang packages. However, the available packages may not be up-to-date.<\/p>\n\n\n\n Erlang\/OTP 24.2.2 is the the current release versions as of this writing.<\/p>\n\n\n\n The default Debian 11 repos provides version 23.2.6;<\/p>\n\n\n\n The default Debian 10 repos provides version 21.2.6;<\/p>\n\n\n\n To install latest release version of Erlang on Debian 10, you first need to install the Erlang repository as follows;<\/p>\n\n\n\n The Erlang distribution also includes OTP (Open Telecom Platform) which provides a rich set of libraries and applications.<\/p>\n\n\n\n Unfortunately, as of this writing, the default Debian 11 repositories do not provided the latest version of Erlang;<\/p>\n\n\n\n Sample output;<\/p>\n\n\n\n Thus, download the current release Erlang Debian 11 DEB binary installer from Erlang downloads page<\/a>.<\/p>\n\n\n\n Next, install it as follows;<\/p>\n\n\n\n If you want to run the latest version of Erlang on Debian 11\/Debian 10, then you can build it from the source.<\/p>\n\n\n\n Before you can proceed, ensure that the configure script above returns no error.<\/p>\n\n\n\n Run smoke test to ensure the build is successful;<\/p>\n\n\n\n Next, access Access the Web Server, http:\/\/<server-IP>.<\/p>\n\n\n\n Install Erlang from Source on Debian 11\/Debian 10 if all well from the test above.<\/p>\n\n\n\n You can now start using Erlang language for your programming.<\/p>\n\n\n\n Check current working directory by running the command pwd().<\/strong>;<\/p>\n\n\n\n You can now start writing your projects in specific directories. For example in the above, I am working from Creating an Hello World program;<\/p>\n\n\n\n Next, execute the program;<\/p>\n\n\n\n You can check further examples on Erlang by Example<\/a>.<\/p>\n\n\n\n Read more on the documentation page<\/a>.<\/p>\n\n\n\n Install RabbitMQ on Debian 11\/Debian 10<\/a><\/p>\n\n\n\nInstall Erlang on Debian 11\/Debian 10<\/h2>\n\n\n\n
\n
Install Erlang using Prebuilt binaries<\/h3>\n\n\n\n
apt-cache policy erlang<\/code><\/pre>\n\n\n\n
erlang:\n Installed: (none)\n Candidate: 1:23.2.6+dfsg-1\n Version table:\n 1:23.2.6+dfsg-1 500\n 500 http:\/\/deb.debian.org\/debian bullseye\/main amd64 Packages\n<\/code><\/pre>\n\n\n\n
apt-cache policy erlang<\/code><\/pre>\n\n\n\n
erlang:\n Installed: (none)\n Candidate: 1:21.2.6+dfsg-1\n Version table:\n 1:21.2.6+dfsg-1 500\n 500 http:\/\/deb.debian.org\/debian buster\/main amd64 Packages\n<\/code><\/pre>\n\n\n\n
Install Erlang on Debian 10 using Prebuilt binaries<\/h4>\n\n\n\n
wget https:\/\/packages.erlang-solutions.com\/erlang-solutions_2.0_all.deb<\/code><\/pre>\n\n\n\n
apt install .\/erlang-solutions_2.0_all.deb<\/code><\/pre>\n\n\n\n
apt update<\/code><\/pre>\n\n\n\n
apt install erlang<\/code><\/pre>\n\n\n\n
Install Erlang on Debian 11 using Prebuilt binaries<\/h4>\n\n\n\n
apt-cache policy erlang<\/code><\/pre>\n\n\n\n
erlang:\n Installed: (none)\n Candidate: 1:23.2.6+dfsg-1\n Version table:\n 1:23.2.6+dfsg-1 500\n 500 http:\/\/deb.debian.org\/debian bullseye\/main amd64 Packages\n<\/code><\/pre>\n\n\n\n
wget https:\/\/packages.erlang-solutions.com\/erlang\/debian\/pool\/esl-erlang_24.2.1-1~debian~buster_amd64.deb<\/code><\/pre>\n\n\n\n
apt install .\/esl-erlang_24.2.1-1~debian~buster_amd64.deb<\/code><\/pre>\n\n\n\n
Install Erlang by Compiling from the Source Code<\/h3>\n\n\n\n
\n
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 rsync g++<\/code><\/pre>\n\n\n\n
\n
VER=24.2.2<\/code><\/pre>\n\n\n\n
wget https:\/\/github.com\/erlang\/otp\/releases\/download\/OTP-$VER\/otp_src_$VER.tar.gz<\/code><\/pre>\n\n\n\n
\n
tar xzf otp_src_$VER.tar.gz<\/code><\/pre>\n\n\n\n
\n
cd otp_src_$VER<\/code><\/pre>\n\n\n\n
export ERL_TOP=`pwd`<\/code><\/pre>\n\n\n\n
.\/configure<\/code><\/pre>\n\n\n\n
make<\/code><\/pre>\n\n\n\n
make release_tests<\/code><\/pre>\n\n\n\n
cd release\/tests\/test_server<\/code><\/pre>\n\n\n\n
~\/otp_src_24.2.2\/bin\/erl -s ts install -s ts smoke_test batch -s init stop<\/code><\/pre>\n\n\n\n
$ERL_TOP\/release\/tests\/test_server\/index.html<\/strong><\/code> in your web browser and make sure that there are zero failed test cases.<\/p>\n\n\n\n
rsync -avP ~\/otp_src_24.2.2 \/var\/www\/html\/<\/code><\/pre>\n\n\n\n
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
chown -R www-data: \/var\/www\/html\/otp_src_24.2.2\/release\/tests\/test_server<\/code><\/pre>\n\n\n\n
systemctl restart apache2<\/code><\/pre>\n\n\n\n
<\/figure><\/div><\/a><\/div>\n\n\n\n
cd ~\/otp_src_24.2.2\/<\/code><\/pre>\n\n\n\n
make install<\/code><\/pre>\n\n\n\n
Using Erlang<\/h2>\n\n\n\n
erl<\/code><\/pre>\n\n\n\n
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> pwd().<\/strong>\n\/home\/kifarunix\nok\n2>\n<\/code><\/pre>\n\n\n\n
\/home\/kifarunix<\/code><\/strong> directory.<\/p>\n\n\n\n
cat > hello_world.erl << 'EOL'\n-module(hello_world).\n -export([hello_world\/0]).\n\nhello_world() ->\n io:fwrite(\"hello world\\n\").\nEOL\n<\/code><\/pre>\n\n\n\n
erl<\/code><\/pre>\n\n\n\n
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> pwd().\n\/home\/kifarunix\nok\n2> c(hello_world).\n{ok,hello_world}\n3> hello_world:hello_world().\nhello world\nok\n4>\n<\/code><\/pre>\n\n\n\n
Other Tutorials<\/h3>\n\n\n\n