想要在虚拟机上的 Linux 环境下,重新搞一下 RabbitMQ 的相关实验,所以重新折腾了下如何操作:

Since RabbitMQ is written in Erlang, we need to have installed the language libraries to run the broker.


      首先还是要把 Erlang 的安装搞定,最简单的方式是直接重 官网

上下载源码包或rpm包再安装,但是我是个喜欢折腾的人,所以我选择了另外一种“比较笨拙”的方式 - 即通过 Linux 系统自带的包管理工具进行安装。

按照 www.erlang-solutions.com 上的说明:

RPM-based Linux distributions RPM packages are signed. To add Erlang Solutions key to execute command: 

# rpm --import http://binaries.erlang-solutions.com/debian/erlang_solutions.asc

Users of Fedora can add this file to /etc/yum.repos.d/ Users of Centos can add this file to /etc/yum.repos.d/ ( RPM Forge must be also added to repos)

其中 erlang_solutions.asc 内容如下:

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.10 (GNU/Linux)

mQINBE8v+uABEACgAlBUDDjc6PF7uI6mlTGnkemHF4trRINtocZKzvyKBmN+pPiV
CjJ3o6NwGmN/McHHyN1sB40n5IZbPtECi5hm+GmHWTkPG0jNQ0f9VDxoIb2eK/Xn
un2KmwJy7W0gth0++Eja5qE4G37o7AUr6hnwSUhFoQ8scahBxiAtya1M4FEeitsY
qY0azafah1Pl6c9I/sdyoH2T3casDByI6aiLK5iP+B5x2j1HKzGGkuTbOdMM0Jos
/pV8HbPBMCQdDhPOKSSEktKr3qgSD/fMzleusCQ5BYzlhAhr5OscCDny/LMiDBOF
8Au92q5DCkjsAlKz49DdpLjep4FwvBLq4DDGj9d8Bz28uUkKnYU8b+c8oPtf9E7D
Uc93i9Ddl6EmZ4QdaTZzR37oUIovKIChYNUh0FLNExhY6VsB3E/BJncaT5D2HkRQ
chUPl2lHVikeJhuHFGY3EkROXMYOxf6FrdVOJa13DflOBssDVwoul45ec9rxW/aA
UG7KCh4ySZ7C1ywSZSr6GXOfVdHjIaYgJpzee86TPnYxF81QpoXsH45tDOxMqMC2
C1keWbzxvv3qxSGFAsCXSeKWNirCRPqsmEW1NpmLNIb2f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wHiYm+ly4Licg5w5mYYx
Vx2bzOJLsGm9xAKp6G4xJHY89PE8y3bksO8pctGkkWmBPCCeH5PPFWrPhLcyiS9P
lvijXzabGtFaVDmxV5oGHW8orpirR3CMgn0DKE5QcH8412d9ByvjK3UcmBTwEnQk
Og0Ce4+ypBIERtufK1osg9lALv/abGtow2S6pdzfdFlISyiLA3HOUQ/spkuPvAe8
ctmKvzuuerI6mVQjg/80PJ4fEV0=
=VAR1
-----END PGP PUBLIC KEY BLOCK-----

其中用于 Centos 的 repo 文件内容如下:

[erlang-solutions]
name=Centos $releasever - $basearch - Erlang Solutions
baseurl=http://binaries.erlang-solutions.com/rpm/centos/$releasever/$basearch
gpgcheck=1
gpgkey=http://binaries.erlang-solutions.com/debian/erlang_solutions.asc
enabled=1


按照上面的意思,需要先安装 RepoForge , 在 RPM Forge

上看到的内容如下:

=====================================================

RPMforge for CentOS 5



The default RPMforge repository does not replace any CentOS base packages. In the past it used to, but those packages are now in a separate repository (rpmforge-extras) which is disabled by default.

You can find a complete listing of the RPMforge package packages at http://packages.sw.be/

Download the rpmforge-release package. Choose one of the two links below, selecting to match your host's architecture. If you are unsure of which one to use you can check your architecture with the command uname -i

The preferred rpmforge-release package to retrieve and to install in order to enable that repository is one of the two listed above.

Install DAG's GPG key

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt



Verify the package you have downloaded

rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm



<!> Security warning: The rpmforge-release package imports GPG keys into your RPM database. As long as you have verified the md5sum of the key injection package, and trust Dag, et al., then it should be as safe as your trust of them extends.

Install the package

rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm



This will add a yum repository config file and import the appropriate GPG keys.

Then try to install something like this

yum install htop


========================================================

      首先通过 uname -i 确认了我的系统是 i386 ;通过 wget 现在对应的 rpm 包后安装,此时会在 /etc/yum.repos.d 下多出 4 个 repo :mirrors-rpmforge、mirrors-rpmforge-extras、mirrors-rpmforge-testing 和 rpmforge.repo 。

      接下来为了验证上述 repo 中确实可以找到我想安装的正确的 Erlang 版本,执行了命令 yum list|grep erlang ,结果如下:

[root@slave2 ~]# yum list|grep erlang
http://binaries.erlang-solutions.com/rpm/centos/5/i386/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: erlang-solutions. Please verify its path and try again


      按照错误信息的意思,应该是路径不对了,故直接在浏览器中打开上面的 http 地址,发现在只有路径 http://binaries.erlang-solutions.com/rpm/centos/6/i386/ 是存在的,而没有对应 5 的路径,坑爹啊!!可是朕不死心,重新回到 https://www.erlang-solutions.com/downloads/download-erlang-otp 上检查所有可用的 Centos 上的 Erlang 版本,结果除了一个 R14B02 32bit 版本 Erlang 是用的 Centos 5.5 的,其余全是用于 6.0 的。尼玛,难道非要我装 Centos 6.0 才行?!思来想去,直接改 repo 信息欺骗网站说自己是 6.0 版本然后安装似乎不是啥好注意,日后恐怕会惹上不必要的麻烦;重新装个 6.0 的系统太烦,毕竟已有系统中有很多东西已经配置好了;直接认栽使用 R14B02 又不甘心。唉~~华山一条路,只能源码安装了~~~(此处省略N万字)

      另外,将 erlang-solutions 的 repo 去掉之后,执行 yum list|grep erlang 得到如下结果:

[root@slave2 ~]# yum list|grep erlang
ftp://ftp.oss.eznetsols.org/linux/centos/5.8/updates/i386/repodata/repomd.xml: [Errno 4] IOError: <urlopen error >
Trying other mirror.
erlang.i386                             R12B-5.12.el5.rf        rpmforge        
erlang-doc.i386                         R12B-5.12.el5.rf        rpmforge

repoforge 上的 Erlang 更老,朕是与时俱进的人,果断放弃!

=================== 2012-12-10 更新 =======================

鉴于有网友说使用 EPEL 比较好,所有自己也搞了下试试:

具体操作请参考网页:

  1. http://www.rabbitmq.com/install-rpm.html
  2. http://fedoraproject.org/wiki/EPEL
  3. http://fedoraproject.org/wiki/EPEL/FAQ#howtouse

最后说一下结论:

      就 Erlang 的包安装而言,EPEL 确实要比 repoforge 新,目前提供的最新版本为 R14B-04。这一点无论是从 repo 文件中还是直接从 http://repos.fedorapeople.org/repos/peter/erlang/epel-5/i386/ 上都可以看出。

      上面都弄好后,执行 yum 命令显示,可以找到 Erlang 安装包。

[root@slave2 yum.repos.d]# yum list|grep erlang
ftp://ftp.oss.eznetsols.org/linux/centos/5.8/updates/i386/repodata/repomd.xml: [Errno 4] IOError: <urlopen error >
Trying other mirror.
erlang.i386                             R14B-04.1.el5           epel-erlang     
erlang-appmon.i386                      R14B-04.1.el5           epel-erlang     
erlang-asn1.i386                        R14B-04.1.el5           epel-erlang     
erlang-common_test.i386                 R14B-04.1.el5           epel-erlang     
erlang-compiler.i386                    R14B-04.1.el5           epel-erlang     
erlang-cosEvent.i386                    R14B-04.1.el5           epel-erlang     
erlang-cosEventDomain.i386              R14B-04.1.el5           epel-erlang     
erlang-cosFileTransfer.i386             R14B-04.1.el5           epel-erlang     
erlang-cosNotification.i386             R14B-04.1.el5           epel-erlang     
erlang-cosProperty.i386                 R14B-04.1.el5           epel-erlang     
erlang-cosTime.i386                     R14B-04.1.el5           epel-erlang     
erlang-cosTransactions.i386             R14B-04.1.el5           epel-erlang     
erlang-crypto.i386                      R14B-04.1.el5           epel-erlang     
erlang-debugger.i386                    R14B-04.1.el5           epel-erlang     
erlang-debuginfo.i386                   R14B-04.1.el5           epel-erlang     
erlang-dialyzer.i386                    R14B-04.1.el5           epel-erlang     
erlang-diameter.i386                    R14B-04.1.el5           epel-erlang     
erlang-doc.i386                         R14B-04.1.el5           epel-erlang     
erlang-docbuilder.i386                  R14B-04.1.el5           epel-erlang     
erlang-edoc.i386                        R14B-04.1.el5           epel-erlang     
erlang-erl_docgen.i386                  R14B-04.1.el5           epel-erlang     
erlang-erl_interface.i386               R14B-04.1.el5           epel-erlang     
erlang-erts.i386                        R14B-04.1.el5           epel-erlang     
erlang-et.i386                          R14B-04.1.el5           epel-erlang     
erlang-eunit.i386                       R14B-04.1.el5           epel-erlang     
erlang-examples.i386                    R14B-04.1.el5           epel-erlang     
erlang-gs.i386                          R14B-04.1.el5           epel-erlang     
erlang-hipe.i386                        R14B-04.1.el5           epel-erlang     
erlang-ic.i386                          R14B-04.1.el5           epel-erlang     
erlang-inets.i386                       R14B-04.1.el5           epel-erlang     
erlang-inviso.i386                      R14B-04.1.el5           epel-erlang     
erlang-jinterface.i386                  R14B-04.1.el5           epel-erlang     
erlang-kernel.i386                      R14B-04.1.el5           epel-erlang     
erlang-megaco.i386                      R14B-04.1.el5           epel-erlang     
erlang-mnesia.i386                      R14B-04.1.el5           epel-erlang     
erlang-observer.i386                    R14B-04.1.el5           epel-erlang     
erlang-odbc.i386                        R14B-04.1.el5           epel-erlang     
erlang-orber.i386                       R14B-04.1.el5           epel-erlang     
erlang-os_mon.i386                      R14B-04.1.el5           epel-erlang     
erlang-otp_mibs.i386                    R14B-04.1.el5           epel-erlang     
erlang-parsetools.i386                  R14B-04.1.el5           epel-erlang     
erlang-percept.i386                     R14B-04.1.el5           epel-erlang     
erlang-pman.i386                        R14B-04.1.el5           epel-erlang     
erlang-public_key.i386                  R14B-04.1.el5           epel-erlang     
erlang-reltool.i386                     R14B-04.1.el5           epel-erlang     
erlang-runtime_tools.i386               R14B-04.1.el5           epel-erlang     
erlang-sasl.i386                        R14B-04.1.el5           epel-erlang     
erlang-snmp.i386                        R14B-04.1.el5           epel-erlang     
erlang-ssh.i386                         R14B-04.1.el5           epel-erlang     
erlang-ssl.i386                         R14B-04.1.el5           epel-erlang     
erlang-stdlib.i386                      R14B-04.1.el5           epel-erlang     
erlang-syntax_tools.i386                R14B-04.1.el5           epel-erlang     
erlang-test_server.i386                 R14B-04.1.el5           epel-erlang     
erlang-toolbar.i386                     R14B-04.1.el5           epel-erlang     
erlang-tools.i386                       R14B-04.1.el5           epel-erlang     
erlang-tv.i386                          R14B-04.1.el5           epel-erlang     
erlang-typer.i386                       R14B-04.1.el5           epel-erlang     
erlang-webtool.i386                     R14B-04.1.el5           epel-erlang     
erlang-wx.i386                          R14B-04.1.el5           epel-erlang     
erlang-xmerl.i386                       R14B-04.1.el5           epel-erlang