
在Ubuntu 20.04 LTS Focal Fossa上安装Erlang步骤1.首先,通过apt在终端中运行以下命令来确保所有系统软件包都是最新的。
sudo apt update sudo apt upgrade
步骤2.在Ubuntu 20.04上安装Erlang。
现在,我们通过运行以下命令将存储库添加到您的Ubuntu系统:
echo \"deb https://packages.erlang-solutions.com/ubuntu focal contrib\" | sudo tee /etc/apt/sources.list.d/rabbitmq.list
之后,更新您的系统软件包列表并安装Erlang:
sudo apt update sudo apt install erlang
安装已完成,要进行验证,我们必须通过提交命令行来使用Shell Erlang:
root@idroot.us:~$ erl Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:6:6] [ds:4:4:16] [async-threads:2] Eshell V11.1 (abort with ^G)
步骤3.使用Hello World程序测试Erlang。
现在,我们通过编写一个简单的Hello World Erlang代码进行测试:
nano hellotest.erl
添加以下文件:
% Test to display Hello World Erlang Code -module(hellotest). -import(io,[fwrite/1]). -export([helloworld/0]). helloworld() -> fwrite(\"Hai Guys.. , Erlang World!\\n\").
保存并关闭,然后使用以下命令执行:
root@idroot.us:~$ erl
Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:6:6] [ds:4:4:16] [async-threads:2]
Eshell V11.1 (abort with ^G)
1> c(hellotest).
{ok,hellotest}
2> hellotest01,helloworld().
** exception error: undefined shell command helloworld/0
3> hellotest01:helloworld().
Hai Guys.. , Erlang World!
ok
恭喜你!您已经成功安装了Erlang。有关其他帮助或有用信息,我们建议您检查Erlang官方网站。