LoginSignup
2
2

More than 5 years have passed since last update.

Install elixir & phoenix framework

Last updated at Posted at 2015-07-23

elixir

Require

Erlang

Install

$ cd /usr/local/src/
$ sudo git clone https://github.com/elixir-lang/elixir.git
$ echo 'PATH=$PATH:/usr/local/src/elixir/bin' << ~/.bashrc
$ cd elixir

## root 
$ make clean test
$ elixir -v
Elixir 1.1.0-dev

$ iex -v
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Elixir 1.1.0-dev

$ mix -v
Mix 1.1.0-dev

phoenix framework

mix archive.install https://github.com/phoenixframework/phoenix/releases/download/v0.14.0/phoenix_new-0.14.0.ez

Create App

$ mix phoenix.new hello_phoenix
* creating hello_phoenix/config/config.exs
* creating hello_phoenix/config/dev.exs
* creating hello_phoenix/config/prod.exs
* creating hello_phoenix/config/prod.secret.exs
* creating hello_phoenix/config/test.exs
* creating hello_phoenix/lib/hello_phoenix.ex
* creating hello_phoenix/lib/hello_phoenix/endpoint.ex
* creating hello_phoenix/test/controllers/page_controller_test.exs
* creating hello_phoenix/test/views/error_view_test.exs
* creating hello_phoenix/test/views/page_view_test.exs
* creating hello_phoenix/test/support/conn_case.ex
* creating hello_phoenix/test/support/channel_case.ex
* creating hello_phoenix/test/test_helper.exs
* creating hello_phoenix/web/controllers/page_controller.ex
* creating hello_phoenix/web/templates/layout/app.html.eex
* creating hello_phoenix/web/templates/page/index.html.eex
* creating hello_phoenix/web/views/error_view.ex
* creating hello_phoenix/web/views/layout_view.ex
* creating hello_phoenix/web/views/page_view.ex
* creating hello_phoenix/web/router.ex
* creating hello_phoenix/web/web.ex
* creating hello_phoenix/mix.exs
* creating hello_phoenix/README.md
* creating hello_phoenix/lib/hello_phoenix/repo.ex
* creating hello_phoenix/test/support/model_case.ex
* creating hello_phoenix/.gitignore
* creating hello_phoenix/brunch-config.js
* creating hello_phoenix/package.json
* creating hello_phoenix/web/static/css/app.scss
* creating hello_phoenix/web/static/js/app.js
* creating hello_phoenix/web/static/assets/robots.txt
* creating hello_phoenix/web/static/vendor/phoenix.js
* creating hello_phoenix/web/static/assets/images/phoenix.png
* creating hello_phoenix/web/static/assets/images/favicon.ico

Fetch and install dependencies? [Yn] Y

Phoenix uses an optional assets build tool called brunch.io
that requires node.js and npm. Installation instructions for
node.js, which includes npm, can be found at http://nodejs.org.

After npm is installed, install your brunch dependencies by
running inside your app:

    $ npm install

If you don't want brunch.io, you can re-run this generator
with the --no-brunch option.

* running mix deps.get

We are all set! Run your Phoenix application:

    $ cd hello_phoenix
    $ mix phoenix.server

You can also run it inside IEx (Interactive Elixir) as:

    $ iex -S mix phoenix.server

scssのコンパイルなどにnode.jsを使用しているので、
nvmとnpmをインストールしておく。

nvm
https://github.com/creationix/nvm

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash

npm
https://github.com/npm/npm

curl -L https://www.npmjs.com/install.sh | sh

作成したアプリケーションディレクトリに
package.jsonがあるので、同ディレクトリ内で
npm installをする。

サーバー起動は以下のコマンドで。
デフォルトのポートは4000。
mix phoenix.server

上記のコマンドを実行したときに、
[error] backend port not found: :inotifywait
がでる場合は、ファイル監視のinotifywaitをインストールする必要がある。

$ sudo yum-config-manager --enable epel
$ sudo yum install -y inotify-tools

image

2
2
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
2
2