官术网_书友最值得收藏!

Installing Elixir

Before we can truly begin our journey into the depths of Elixir, we need to install it and make sure our environment is sane. I will cover some basic installations for most OSes. As far as hardware requirements are concerned, there really are none. However, if you happen to not have a multi-core CPU, you may miss out on the inherent speed benefits of the runtime.

GNU/Linux

Most distributions, today, will have Elixir in their repositories and this is the preferred way to install Elixir. Installing Elixir from your distribution's repositories will also take care of installing Erlang.

If you are using a Red Hat-based distribution of GNU/Linux, you can use the yum package manager tool to install Elixir:

# yum install elixir
...

Transaction Summary
===========================================================================
Install 1 Package (+14 Dependent packages)

Total download size: 16 M
Installed size: 31 M
Is this ok [y/d/N]: y
...
Complete!

If, on the other hand, you use a Debian-based distribution, you will need to add the Erlang Solutions repository and install Elixir using dpkg and apt-get:

$ wget {.deb for your distribution}
$ sudo dpkg -i {downloaded version of erlang}.deb
$ sudo apt-get update
$ sudo apt-get install elixir
...
The following extra packages will be installed:
 erlang-asn1 erlang-base erlang-crypto erlang-inets erlang-mnesia
 erlang-public-key erlang-runtime-tools erlang-ssl erlang-syntax-tools
Suggested packages:
 erlang erlang-manpages erlang-doc erlang-tools
The following NEW packages will be installed:
 elixir erlang-asn1 erlang-base erlang-crypto erlang-inets erlang-mnesia
 erlang-public-key erlang-runtime-tools erlang-ssl erlang-syntax-tools
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.9 MB of archives.
After this operation, 23.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
...
Setting up erlang-crypto (1:17.5) ...
Setting up erlang-mnesia (1:17.5) ...
Setting up erlang-runtime-tools (1:17.5) ...
Setting up erlang-syntax-tools (1:17.5) ...
Setting up erlang-asn1 (1:17.5) ...
Setting up erlang-public-key (1:17.5) ...
Setting up erlang-ssl (1:17.5) ...
Setting up erlang-inets (1:17.5) ...
Setting up elixir (1.0.4-1) ...

Note

The .deb file you download will be specific to your distribution. The Erlang Solutions download page has as many to choose from.

Or, if you're like me and you're running Arch Linux, you can install Elixir with pacman:

$ sudo pacman -S elixir erlang-nox
resolving dependencies...
looking for conflicting packages...

Packages (2) elixir-1.0.4-1 erlang-nox-17.5-1

Total Installed Size: 107.70 MiB

:: Proceed with installation? [Y/n] y
(2/2) checking keys in keyring [#################] 100%
(2/2) checking package integrity [#################] 100%
(2/2) loading package files [#################] 100%
(2/2) checking for file conflicts [#################] 100%
(2/2) checking available disk space [#################] 100%
(1/2) installing erlang-nox [#################] 100%
Optional dependencies for erlang-nox
 erlang-unixodbc: database support
 java-environment: for Java support
 lksctp-tools: for SCTP support
(2/2) installing elixir [#################] 100%

I'm suggesting the non-X (erlang-nox) version as Arch separates the Erlang releases based on whether it has GUI libraries included or not, and we will not need them for this book. If you later decide that you want or need them, you can simply install the regular Erlang package and tell pacman to remove the non-X version.

Apple Mac OS X

For Apple Mac OS X, you are hopefully using Homebrew or MacPorts.

Use the following command to install Elixir via Homebrew:

$ brew update; brew install elixir

Use the following command to install Elixir via MacPorts:

$ sudo port install elixir

Windows

If you're using Microsoft Windows, you can download a precompiled binary from the Elixir INSTALL (http://elixir-lang.org/install.html) page. Go through the installation wizard to complete the installation.

Manual installation – binary

Manual installation should really be avoided if at all possible, but I'll include it in case your system isn't listed here or on the installation page, or for some other unforeseeable reason.

First, you will need to download and install an Erlang binary provided by Erlang Solution (https://www.erlang-solutions.com/downloads/download-erlang-otp). Next, you will need to download a precompiled ZIP file from Elixir's releases page. Unpack the ZIP folder to the location of your choice. Once unpacked, you should update your PATH variable to include the bin directory of the Elixir release.

Manual installation – source

Another option with respect to manually installing Elixir is to build Elixir from source and, by extension, build and install Erlang from source.

The latest source of Erlang can be found on its GitHub page ( GitHub (https://github.com/elixir-lang/elixir-lang.github.com).

主站蜘蛛池模板: 体育| 新邵县| 潼关县| 富顺县| 深泽县| 右玉县| 石柱| 济南市| 丁青县| 高台县| 河间市| 承德县| 贵南县| 台湾省| 出国| 温泉县| 阳城县| 大埔区| 阿拉善右旗| 文登市| 安图县| 九龙城区| 射洪县| 诏安县| 乌鲁木齐市| 乌鲁木齐市| 贵阳市| 嘉善县| 桑植县| 旌德县| 阿合奇县| 灵宝市| 疏附县| 奎屯市| 徐州市| 澄迈县| 延吉市| 黑水县| 壶关县| 高唐县| 田阳县|