在 RHEL7 上安装最新版本的 Erlang

Installing up-to-date version of Erlang on RHEL7

我正在尝试将最新的(在撰写本文时为 20.3 版)Erlang 发行版安装到 RHEL7(准确地说是 7.5 版)中。

Google 告诉我最新的 Erlang 发行版由 Erlang Solutions at https://packages.erlang-solutions.com/ 维护(谢谢!)

您还可以找到有关如何添加存储库以便可以使用包管理器安装 Erlang 的说明:

Installation using repository

  1. Adding repository entry

To add Erlang Solutions repository (including our public key for verifying signed package) to your system, call the following commands:

wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm

但是,如果我 运行 命令(我 运行 作为 root 的 rpm 命令)没有 Erlang Solutions repo 添加到 yum repolist。 RHEL7 与 Centos 不同吗?是说明有问题还是我做错了什么?

Erlang Solutions repo(和安装说明)也引用自

我找到了根本原因并能够从 Erlang 解决方案存储库安装 Erlang。

根本原因是 $releasever 在 RHEL 中与在 Centos 中不同,因此无法使用该变量,必须将其更改为硬编码值。

以下是如何设置 yum 的详细步骤,以便可以使用 yum 从 Erlang Solutions 和 EPEL 存储库安装 Erlang 及其依赖项。

添加以下 Erlang 解决方案存储库文件:

[root@red ~]# cat /etc/yum.repos.d/erlang-solutions.repo 
[erlang-solutions]
name=CentOS $releasever - $basearch - Erlang Solutions
baseurl=https://packages.erlang-solutions.com/rpm/centos/7/$basearch
enabled=1
gpgcheck=1
gpgkey=https://packages.erlang-solutions.com/rpm/erlang_solutions.asc
[root@red ~]#

请注意,必须将 baseurl 从

更改为
https://packages.erlang-solutions.com/rpm/centos/$releasever/$basearch

https://packages.erlang-solutions.com/rpm/centos/7/$basearch

也为 Erlang 所需的依赖项添加 EPEL 存储库(wxBase、wxGTK、wxGTK-gl):

[root@red ~]# rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Repolist 现在看起来:

[root@red ~]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
repo id                                    repo name                                                      status
epel/x86_64                                Extra Packages for Enterprise Linux 7 - x86_64                 12,517
erlang-solutions/x86_64                    CentOS 7Server - x86_64 - Erlang Solutions                        992
rhel-7-server-extras-rpms/x86_64           Red Hat Enterprise Linux 7 Server - Extras (RPMs)                 814
rhel-7-server-optional-rpms/7Server/x86_64 Red Hat Enterprise Linux 7 Server - Optional (RPMs)            14,947
rhel-7-server-rpms/7Server/x86_64          Red Hat Enterprise Linux 7 Server (RPMs)                       20,120
rhel-7-server-rt-rpms/7Server/x86_64       Red Hat Enterprise Linux for Real Time (RHEL 7 Server) (RPMs)     281
rhel-server-rhscl-7-rpms/7Server/x86_64    Red Hat Software Collections RPMs for Red Hat Enterprise Linux  9,961
repolist: 59,632
[root@red ~]#

Erlang 包可用!

[root@red ~]# yum info erlang
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Available Packages
Name        : erlang
Arch        : x86_64
Version     : 20.3
Release     : 1.el7.centos
Size        : 17 k
Repo        : erlang-solutions/x86_64
Summary     : General-purpose programming language and runtime environment
URL         : http://www.erlang.org
License     : ERPL
Description : Erlang is a general-purpose programming language and runtime
            : environment. Erlang has built-in support for concurrency, distribution
            : and fault tolerance. Erlang is used in several large telecommunication
            : systems from Ericsson.

[root@red ~]#

最后你可以用 yum -y install erlang 安装 Erlang。

安装了来自几个不同存储库的以下软件包:

================================================================================================================
 Package                         Arch            Version                      Repository                   Size
================================================================================================================
Installing:
 erlang                          x86_64          20.3-1.el7.centos            erlang-solutions             17 k
Installing for dependencies:
 SDL                             x86_64          1.2.15-14.el7                rhel-7-server-rpms          204 k
 erlang-asn1                     x86_64          20.3-1.el7.centos            erlang-solutions            928 k
 erlang-common_test              x86_64          20.3-1.el7.centos            erlang-solutions            1.3 M
 erlang-compiler                 x86_64          20.3-1.el7.centos            erlang-solutions            1.4 M
 erlang-cosEvent                 x86_64          20.3-1.el7.centos            erlang-solutions            170 k
 erlang-cosEventDomain           x86_64          20.3-1.el7.centos            erlang-solutions            137 k
 erlang-cosFileTransfer          x86_64          20.3-1.el7.centos            erlang-solutions            200 k
 erlang-cosNotification          x86_64          20.3-1.el7.centos            erlang-solutions            842 k
 erlang-cosProperty              x86_64          20.3-1.el7.centos            erlang-solutions            188 k
 erlang-cosTime                  x86_64          20.3-1.el7.centos            erlang-solutions            124 k
 erlang-cosTransactions          x86_64          20.3-1.el7.centos            erlang-solutions            196 k
 erlang-crypto                   x86_64          20.3-1.el7.centos            erlang-solutions            212 k
 erlang-debugger                 x86_64          20.3-1.el7.centos            erlang-solutions            468 k
 erlang-dialyzer                 x86_64          20.3-1.el7.centos            erlang-solutions            838 k
 erlang-diameter                 x86_64          20.3-1.el7.centos            erlang-solutions            835 k
 erlang-edoc                     x86_64          20.3-1.el7.centos            erlang-solutions            366 k
 erlang-eldap                    x86_64          20.3-1.el7.centos            erlang-solutions            125 k
 erlang-erl_docgen               x86_64          20.3-1.el7.centos            erlang-solutions            156 k
 erlang-erl_interface            x86_64          20.3-1.el7.centos            erlang-solutions            263 k
 erlang-erts                     x86_64          20.3-1.el7.centos            erlang-solutions            2.0 M
 erlang-et                       x86_64          20.3-1.el7.centos            erlang-solutions            189 k
 erlang-eunit                    x86_64          20.3-1.el7.centos            erlang-solutions            185 k
 erlang-examples                 x86_64          20.3-1.el7.centos            erlang-solutions            1.0 M
 erlang-hipe                     x86_64          20.3-1.el7.centos            erlang-solutions            3.2 M
 erlang-ic                       x86_64          20.3-1.el7.centos            erlang-solutions            1.0 M
 erlang-inets                    x86_64          20.3-1.el7.centos            erlang-solutions            921 k
 erlang-jinterface               x86_64          20.3-1.el7.centos            erlang-solutions            179 k
 erlang-kernel                   x86_64          20.3-1.el7.centos            erlang-solutions            1.3 M
 erlang-megaco                   x86_64          20.3-1.el7.centos            erlang-solutions            6.0 M
 erlang-mnesia                   x86_64          20.3-1.el7.centos            erlang-solutions            915 k
 erlang-observer                 x86_64          20.3-1.el7.centos            erlang-solutions            980 k
 erlang-odbc                     x86_64          20.3-1.el7.centos            erlang-solutions             87 k
 erlang-orber                    x86_64          20.3-1.el7.centos            erlang-solutions            1.1 M
 erlang-os_mon                   x86_64          20.3-1.el7.centos            erlang-solutions            135 k
 erlang-otp_mibs                 x86_64          20.3-1.el7.centos            erlang-solutions             33 k
 erlang-parsetools               x86_64          20.3-1.el7.centos            erlang-solutions            208 k
 erlang-public_key               x86_64          20.3-1.el7.centos            erlang-solutions            689 k
 erlang-reltool                  x86_64          20.3-1.el7.centos            erlang-solutions            404 k
 erlang-runtime_tools            x86_64          20.3-1.el7.centos            erlang-solutions            253 k
 erlang-sasl                     x86_64          20.3-1.el7.centos            erlang-solutions            342 k
 erlang-snmp                     x86_64          20.3-1.el7.centos            erlang-solutions            1.9 M
 erlang-ssh                      x86_64          20.3-1.el7.centos            erlang-solutions            630 k
 erlang-ssl                      x86_64          20.3-1.el7.centos            erlang-solutions            969 k
 erlang-stdlib                   x86_64          20.3-1.el7.centos            erlang-solutions            3.2 M
 erlang-syntax_tools             x86_64          20.3-1.el7.centos            erlang-solutions            493 k
 erlang-tools                    x86_64          20.3-1.el7.centos            erlang-solutions            638 k
 erlang-typer                    x86_64          20.3-1.el7.centos            erlang-solutions             28 k
 erlang-wx                       x86_64          20.3-1.el7.centos            erlang-solutions            4.7 M
 erlang-xmerl                    x86_64          20.3-1.el7.centos            erlang-solutions            1.1 M
 mesa-libGLU                     x86_64          9.0.0-4.el7                  rhel-7-server-rpms          196 k
 unixODBC                        x86_64          2.3.1-11.el7                 rhel-7-server-rpms          413 k
 wxBase                          x86_64          2.8.12-20.el7                epel                        588 k
 wxGTK                           x86_64          2.8.12-20.el7                epel                        2.9 M
 wxGTK-gl                        x86_64          2.8.12-20.el7                epel                         34 k

Transaction Summary
================================================================================================================
Install  1 Package (+54 Dependent packages)

享受你的前沿工具链!

[jani@red ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.5 (Maipo)
[jani@red ~]$ erl
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V9.3  (abort with ^G)
1>

RabbitMQ安装说明says it's a good idea to lock installed erlang version. See How to restrict yum to install or upgrade a package to a fixed specific package version?

[root@red ~]# yum -y install yum-plugin-versionlock
[...]
[root@red ~]# yum versionlock erlang wxBase wxGTK wxGTK-gl
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager, versionlock
Adding versionlock on: 0:wxGTK-2.8.12-20.el7
Adding versionlock on: 0:wxGTK-gl-2.8.12-20.el7
Adding versionlock on: 0:wxBase-2.8.12-20.el7
Adding versionlock on: 0:erlang-20.3-1.el7.centos
versionlock added: 4
[root@red ~]#