Linux 安裝Erlang

Erlang目前已是Fedora和Debian/Ubuntu軟件倉庫中的一部分。html

Erlang目前最新的版本是OTP 17.0。Erlang是一種編程語言,用於構建大規模、高可伸縮性、高可用性的軟實時系統的編程語言。它已經在電信、金融、電子商務、網絡電話和即時消息中獲得應用。Erlang的運行時系統已經內建了對併發、分佈式和容錯的支持。java

OTP是Erlang庫和設計原則的集合,提供了開發各類系統的中間件。它包含了本身的分佈式數據庫、面向其它編程語言的接口、調試和發佈處理工具等。c++

BEAM是Erlang代碼執行所需的虛擬機。Erlang代碼編譯後的擴展名爲.beam。ERTS是Erlang的運行時系統,他包括了BEAM、內核和標準庫等組件。

官方推薦從源碼安裝Erlang,所以下面開始從源碼安裝OTP 17.0。

下載OTP 17.0源碼:http://www.erlang.org/download/otp_src_17.0.tar.gz
shell

[html] view plaincopy在CODE上查看代碼片派生到個人代碼片數據庫

  1. # tar zvxf otp_src_17.0.tar.gz  編程

  2. # mv otp_src_17.0/ otp  網絡

  3. # cd otp  併發

  4. # ./configure --prefix=/home/erlang --without-javac  ssh


報錯:
configure: error: No curses library functions found
configure: error: /bin/sh '/root/otp/erts/configure' failed for erts

async

[html] view plaincopy在CODE上查看代碼片派生到個人代碼片

  1. # yum -y install ncurses-devel  

  2. # ./configure --prefix=/home/erlang --without-javac  


報錯
*********************************************************************
**********************  APPLICATIONS DISABLED  **********************
*********************************************************************
crypto         : No usable OpenSSL found
jinterface     : Java compiler disabled by user
odbc           : ODBC library - link check failed
orber          : No C++ compiler found
ssh            : No usable OpenSSL found
ssl            : No usable OpenSSL found
*********************************************************************

[html] view plaincopy在CODE上查看代碼片派生到個人代碼片

  1. # yum list | grep ssl  

  2. # yum install openssl-devel  

  3. # ./configure --prefix=/home/erlang --without-javac  


報錯
*********************************************************************
**********************  APPLICATIONS DISABLED  **********************
*********************************************************************
jinterface     : Java compiler disabled by user
odbc           : ODBC library - link check failed
orber          : No C++ compiler found
*********************************************************************

[html] view plaincopy在CODE上查看代碼片派生到個人代碼片

  1. # yum list | grep ODBC  

  2. # yum install unixODBC-devel  

  3. # ./configure --prefix=/home/erlang --without-javac  


報錯
*********************************************************************
**********************  APPLICATIONS DISABLED  **********************
*********************************************************************
jinterface     : Java compiler disabled by user
orber          : No C++ compiler found
*********************************************************************

[html] view plaincopy在CODE上查看代碼片派生到個人代碼片

  1. # yum install gcc-c++  

  2. # ./configure --prefix=/home/erlang --without-javac  

  3. # make  

  4. # make install  


安裝完成!

測試Erlang是否安裝正確

[html] view plaincopy在CODE上查看代碼片派生到個人代碼片

  1. # /home/erlang/bin/erl  

  2. Erlang/OTP 17 [erts-6.0] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]  

  3.   

  4. Eshell V6.0  (abort with ^G)  

  5. 1> EvenN = lists:filter (fun (N) -> N rem 2 == 0 end, lists:seq(1,100)).  

  6. [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,  

  7.  44,46,48,50,52,54,56,58|...]  

  8. 2> halt().  


在PATH環境變量添加Erlang的bin路徑,以便執行。

【安裝總結】

從源碼編譯安裝Erlang,有兩個庫或工具是必須的:

一是完整的GCC編譯器環境
二是Ncurses開發庫

還有一些庫或工具,若是沒有它們,在編譯配置時會出現警告信息,並且可能不能經過配置。這些庫有:

1)OpenSSL開發庫

2)ODBC開發庫

3)Java編譯器

相關文章
相關標籤/搜索