0.Erlang、OTP

予早 2025-02-21 01:08:23
Categories: Tags:

Erlang/OTP

简介

https://www.erlang.org/doc/system_architecture_intro/sys_arch_intro.html

Erlang is a general-purpose programming language with built-in support for concurrency, distribution and fault tolerance.

OTP (Open Telecom Platform) is aimed at providing time-saving and flexible development for robust, adaptable telecom systems. It consists of an Erlang runtime system, a number of ready-to-use components mainly written in Erlang, and a set of design principles for Erlang programs. Since Erlang and OTP are closely interconnected the term Erlang/OTP is normally used instead of OTP.

安装

https://www.erlang-solutions.com/downloads/

ubuntu@bdjxfdxleoxlsjx:~$ sudo dpkg -i esl-erlang_26.2.1-1~ubuntu~focal_amd64.deb 
(Reading database ... 78134 files and directories currently installed.)
Preparing to unpack esl-erlang_26.2.1-1~ubuntu~focal_amd64.deb ...
Unpacking esl-erlang (1:26.2.1-1) over (1:26.2.1-1) ...

dpkg: dependency problems prevent configuration of esl-erlang:
 esl-erlang depends on libncurses5; however:
  Package libncurses5 is not installed.
 esl-erlang depends on libsctp1; however:
  Package libsctp1 is not installed.

dpkg: error processing package esl-erlang (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 esl-erlang



ubuntu@bdjxfdxleoxlsjx:~$ sudo apt install libncurses5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 esl-erlang : Depends: libsctp1 but it is not going to be installed
              Recommends: libwxbase2.8-0 but it is not installable or
                          libwxbase3.0-0 but it is not installable or
                          libwxbase3.0-0v5 but it is not going to be installed
              Recommends: libwxgtk2.8-0 but it is not installable or
                          libwxgtk3.0-0 but it is not installable or
                          libwxgtk3.0-0v5 but it is not installable or
                          libwxgtk3.0-gtk3-0v5 but it is not going to be installed
 libncurses5 : Depends: libtinfo5 (= 6.2-0ubuntu2.1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).



ubuntu@bdjxfdxleoxlsjx:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libncurses5 libsctp1 libtinfo5
Suggested packages:
  lksctp-tools
The following NEW packages will be installed:
  libncurses5 libsctp1 libtinfo5
0 upgraded, 3 newly installed, 0 to remove and 61 not upgraded.
1 not fully installed or removed.
Need to get 188 kB of archives.
After this operation, 901 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 libtinfo5 amd64 6.2-0ubuntu2.1 [83.4 kB]
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 libncurses5 amd64 6.2-0ubuntu2.1 [96.9 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libsctp1 amd64 1.0.18+dfsg-1 [7,876 B]
Fetched 188 kB in 10s (19.0 kB/s)
Selecting previously unselected package libtinfo5:amd64.
(Reading database ... 78134 files and directories currently installed.)
Preparing to unpack .../libtinfo5_6.2-0ubuntu2.1_amd64.deb ...
Unpacking libtinfo5:amd64 (6.2-0ubuntu2.1) ...
Selecting previously unselected package libncurses5:amd64.
Preparing to unpack .../libncurses5_6.2-0ubuntu2.1_amd64.deb ...
Unpacking libncurses5:amd64 (6.2-0ubuntu2.1) ...
Selecting previously unselected package libsctp1:amd64.
Preparing to unpack .../libsctp1_1.0.18+dfsg-1_amd64.deb ...
Unpacking libsctp1:amd64 (1.0.18+dfsg-1) ...
Setting up libsctp1:amd64 (1.0.18+dfsg-1) ...
Setting up libtinfo5:amd64 (6.2-0ubuntu2.1) ...
Setting up libncurses5:amd64 (6.2-0ubuntu2.1) ...
Setting up esl-erlang (1:26.2.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.14) ...
ubuntu@bdjxfdxleoxlsjx:~$ sudo apt install libncurses5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libncurses5 is already the newest version (6.2-0ubuntu2.1).
libncurses5 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 61 not upgraded.


ubuntu@bdjxfdxleoxlsjx:~$ sudo dpkg -i esl-erlang_26.2.1-1~ubuntu~focal_amd64.deb 
(Reading database ... 78155 files and directories currently installed.)
Preparing to unpack esl-erlang_26.2.1-1~ubuntu~focal_amd64.deb ...
Unpacking esl-erlang (1:26.2.1-1) over (1:26.2.1-1) ...
Setting up esl-erlang (1:26.2.1-1) ...
ubuntu@bdjxfdxleoxlsjx:~$ erl

查看版本

查看Erlang/OTP版本

https://stackoverflow.com/questions/9560815/how-to-get-erlangs-release-version-number-from-a-shell

erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell
erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell

查看Eshell版本

erl -version
# eshell中使用q().可以退出,是init:stop()的别名
# erl 每个语句结束用“.”结尾

erlang.cookie是erlang实现分布式的必要文件,erlang分布式的每个节点上要保持相同的.erlang.cookie文件,同时保证文件的权限是400。