環境
OS : CentOS 6.7
Erlang R14B04 ⇒ Erlang/OTP 21 [DEVELOPMENT]
Eshell V5.8.5 ⇒ Eshell V9.0.1
Elixir : 1.6.0-dev
経緯
CentOS
にElixir
環境を構築しようとして、インストール方法通りにyum install elixir
を実行したのだが、elixir
など知らんとのエラーとなってしまった。
# yum install elixir
No package elixir available.
Error: Nothing to do
その為、Erlang
からyum install erlang
でインストールした。
# yum install erlang
====================================
Install 72 Package(s)
Upgrade 1 Package(s)
Total download size: 57 M
Is this ok [y/N]: y
Downloading Packages:
Installed:
erlang.x86_64 0:R14B-04.3.el6
Dependency Installed:
SDL.x86_64 0:1.2.14-7.el6_7.1
Dependency Updated:
libdrm.x86_64 0:2.4.65-2.el6
Complete!
次に、Github
からElixir
をClone
してインストールしようとしたが、今度はErlang
のバージョンが古過ぎてElixir
がインストールできない。
# git clone https://github.com/elixir-lang/elixir.git
# cd /usr/local/lib/elixir/
# make clean test
cd lib/elixir && "/usr/bin/elixir/rebar" clean
=ERROR REPORT==== 6-Jul-2017::12:17:46 ===
Loading of /usr/bin/elixir/rebar/rebar/ebin/rebar.beam failed: badfile
escript: exception error: undefined function rebar:main/1
in function escript:run/2
in call from escript:start/1
in call from init:start_it/1
in call from init:start_em/1
=ERROR REPORT==== 6-Jul-2017::12:17:46 ===
beam/beam_load.c(1365): Error loading module rebar:
use of opcode 153; this emulator supports only up to 152
make: *** [clean] Error 127
Erlangのバージョンが古いようだ。
# /usr/bin/erl -v
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]
Eshell V5.8.5 (abort with ^G)
困ってしまって、いっそのこと最新版のErlang
とElixir
をGithub
からのソースからmake
インストールしようという試みを下記に記す。
まさか、最近になってもソースコードからコンパイルするとは思わなかった。
で、ここからが本題。
Erlangのインストール
git clone https://github.com/erlang/otp.git
cd otp
./otp_build autoconf
./configure
make
make install
デフォルトでは、/usr/local/bin/
にerl
のシンボリックリンクが作成され、実体は/usr/local/lib/erlang
にインストールされるようだ。最新のErlangがインストールされた。
# /usr/local/bin/erl -v
Erlang/OTP 21 [DEVELOPMENT] [erts-9.0.1] [source-e8a2cae] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V9.0.1 (abort with ^G)
Elixirのインストール
Elixir
が配備されている/usr/local/lib/elixir
に移動して、先程Github
からclone
したElixir
を再度インストールしてみる。
# cd /usr/local/lib/elixir/
# make clean test
~/.bash_profile
にElixir
へのパス/usr/local/lib/elixir/bin
を通しても良いのだが、先程インストールしたErlang
に合わせて、 /usr/local/bin
に、シンボリックリンクを作成した。
# cd /usr/local/bin
# ln -s ../lib/elixir/bin/elixir elixir
# ln -s ../lib/elixir/bin/elixirc elixirc
# ln -s ../lib/elixir/bin/iex iex
# ln -s ../lib/elixir/bin/mix mix
とりあえず、最新のElixir
がインストールできた。
$ iex
Erlang/OTP 21 [DEVELOPMENT] [erts-9.0.1] [source-e8a2cae] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)
Interactive Elixir (1.6.0-dev) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
サーバの言語設定に関しての警告は出ているのだが、とりあえずインストールに関してはうまくいった。