Total Pageviews

Wednesday 5 February 2014

在linux vps上安装erlang环境和rebar环境


erlang在各个系统下的安装包的下载地址:(注意:source包的最高版本仅为17.0;如果要安装18.x或更高的版本,就只能去下载你的相应系统下的安装包!)
https://packages.erlang-solutions.com/erlang/

假设你的系统为debian 8,64 bit,则:
apt-get update
apt-get -f install
apt-get -y install libwxbase3.0-0 libwxbase3.0-dev

wget http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/esl-erlang_20.3-1~debian~jessie_amd64.deb

(如果是debian 8,32 bit,则下载
http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/esl-erlang_20.3-1~debian~jessie_i386.deb
dpkg -i esl-erlang_20.3-1~debian~jessie_amd64.deb
会显示:
...
Setting up esl-erlang (1:19.0) ...
root@ar:~# which erl
/usr/bin/erl
root@ar:~# erl
(会显示:Erlang/OTP 19)
-----------------

rebar环境的搭建看下文:(需先搭建erlang环境.注意:必须先搭建erlang环境,否则下面运行

./bootstrap时,会出现找不到escript文件的错误)
$ git clone git://github.com/rebar/rebar.git
$ cd rebar
$ ./bootstrap
Recompile: src/getopt
...
Recompile: src/rebar_utils
==> rebar (compile)
Congratulations! You now have a self-contained script called "rebar" in
your current working directory. Place this script anywhere in your path
and you can use rebar to build OTP-compliant apps.
/root/rebar/rebar即为rebar程序的可执行文件。
echo "export PATH=$PATH:/root/rebar/" >> /etc/profile
. /etc/profile
----------------- 

Fortunately many languages can be installed (Clojure, Dart, Haskell, Erlang, Scala, etc).
This guide will cover how to setup your box to support Erlang.

Downloading Erlang

Since you can’t create folders outside your home folder, you will need to install Erlang within it. Create a hidden folder called .tools:
mkdir ~/.tools
Navigate to this new directory and download Erlang:
cd ~/.tools

wget https://elearning.erlang-solutions.com/binaries/sources/otp_src_R16B01.tar.gz
(或者wget https://packages.erlang-solutions.com/erlang/esl-erlang-src/otp_src_17.1.tar.gz)
Note: Other versions of Erlang may be found on erlang-solutions.com
Now you will want to extract this file which will create the folder otp_src_R16B01/ inside.
tar zxvf otp_src_R16B01.tar.gz

Installing

Navigate to the Erlang directory cd ~/.tools/otp_src_R16B01/ and run the following command:
./configure (需先安装ncurses: apt-get install ncurses-dev,yum install ncurses-devel)
Next, run make (this can take a few minutes,大概耗时8分钟):
make
(make完成后,不要运行make install)
Once finished you should have a working Erlang/OTP system. You can try this out by typing bin/erl


Setting up PATH

Once the tar file is extracted, edit ~/.bashrc and add the bin directory to your PATH:
PATH=$PATH:$HOME/.tools/otp_src_R16B01/bin/

Reload the ~/.bashrc file by running source ~/.bashrc, and verify the .tools folder was added to your PATH with echo $PATH.

from http://help.nitrous.io/faq-erlang/

还可参考:
http://blog.csdn.net/wyne_lulu/article/details/7534073
http://www.w3hacker.com/centos-源代码编译-安装-erlang.html