在 RHEL7 上安装最新版本的 Erlang

Posted

技术标签:

【中文标题】在 RHEL7 上安装最新版本的 Erlang【英文标题】:Installing up-to-date version of Erlang on RHEL7 【发布时间】:2018-10-13 20:07:53 【问题描述】:

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

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

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

使用存储库安装

    添加存储库条目

要将 Erlang Solutions 存储库(包括我们用于验证签名包的公钥)添加到您的系统,请调用以下命令:

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 存储库添加到 yum repolist。 RHEL7 与 Centos 有什么不同,还是说明有问题或我做错了什么?

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

https://www.rabbitmq.com/install-rpm.html https://elixir-lang.org/install.html#installing-erlang https://***.com/a/38911475/272735

【问题讨论】:

【参考方案1】:

我找到了根本原因,并且能够从 Erlang Solutions 存储库安装 Erlang。

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

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

添加以下 Erlang Solutions 存储库文件:

[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 锁定已安装的 erlang 版本是个好主意。见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 ~]#

【讨论】:

以上是关于在 RHEL7 上安装最新版本的 Erlang的主要内容,如果未能解决你的问题,请参考以下文章

在 CentOS 7 上安装 RabbitMQ

RabbitMQ安装Erlang安装 windows

1.在windows下安装rabbitMQ

RabbitMQ学习系列: RabbitMQ安装与配置

CentOS 10分钟快速安装rabbitMQ 最新版

rhel7 编写CMakeList.txt编译运行MySQL官方例子代码