LoginSignup
3
4

More than 5 years have passed since last update.

CentOSにElixirインストール

Last updated at Posted at 2017-07-06

環境

OS : CentOS 6.7
Erlang R14B04 ⇒ Erlang/OTP 21 [DEVELOPMENT]
Eshell V5.8.5 ⇒ Eshell V9.0.1
Elixir : 1.6.0-dev

経緯

CentOSElixir環境を構築しようとして、インストール方法通りに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からElixirCloneしてインストールしようとしたが、今度は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)

困ってしまって、いっそのこと最新版のErlangElixirGithubからのソースから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_profileElixirへのパス/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)> 

サーバの言語設定に関しての警告は出ているのだが、とりあえずインストールに関してはうまくいった。

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4