Step 1 - Add the repository
First, use the following command to add erlang apt repository on your system. You can simply download the package repository erlang from its official website and install it on your system.
$ wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb $ sudo dpkg -i erlang-solutions_1.0_all.deb
Step 2 - Erlang installed on Ubuntu
Now you can use the following command to install erlang packages on your system. It will also install all dependencies.
$ sudo apt-get update $ sudo apt-get install erlang
In addition, you can install the full erlang, including Erlang / OTP platform and all of its applications.
$ sudo apt-get update $ sudo apt-get install esl-erlang
Step 3 - Erlang Hello World program
Let the Erlang hello world program started. First, create a file with the following helloworld.erl.
$ We helloworld.erl
Add the following content.
% hello world program -module(helloworld). -export([start/0]). start() -> io:fwrite("Hello World!\n").
Use the following command to compile now hello world program.
$ erlc helloworld.erl
The above command will create a file in the current directory helloworld.beam. You can now run your program.
$ erl -noshell -s helloworld start -s init stop Hello World!
【转】https://www.linuxidc.com/Linux/2017-12/149205.htm