markdown Elixir安装指南
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Elixir安装指南相关的知识,希望对你有一定的参考价值。
# Elixir installation guide
__Version numbers should be the ones you want__. Here I do it with the last ones available at the moment of writing.
The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows
the intention to keep its packages up to date. There you can simply `sudo dnf install erlang elixir` and you are good to go.
Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to
a specific version, you will need to compile it yourself. Then `asdf` is your best friend.
## Install needed system packages
### Fedora
```bash
sudo dnf install make automake gcc gcc-c++ kernel-devel git wget openssl-devel ncurses-devel wxBase3 wxGTK3-devel m4
```
### Ubuntu
```bash
sudo apt-get install build-essential git wget libssl-dev libreadline-dev libncurses5-dev zlib1g-dev m4 curl wx-common libwxgtk3.0-dev autoconf
```
#### Optional Erlang dependencies
If you want Erlang to generate its docs when compiling, or if you need the `jinterface` or the `ODBC` applications, then you may need to install some extra dependencies. The Erlang compilation script simply skips these if dependencies are not met, so all of this is optional. For Ubuntu and derivatives these dependencies seem to be the `java` and `javac` to be installed, and:
```bash
sudo apt-get install libxml2-utils xsltproc fop unixodbc unixodbc-bin unixodbc-dev
```
## Install `asdf` and its plugins
`asdf` lives in https://github.com/asdf-vm/asdf
Follow its installation instructions, which at the moment of writing were:
```bash
cd
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.0
# For Ubuntu or other linux distros
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
```
On a new terminal, install Erlang and Elixir plugins:
```bash
asdf plugin-add erlang
asdf plugin-add elixir
```
## Install Erlang and Elixir
```bash
asdf install erlang 21.1
asdf install elixir 1.7.4
```
Then set them as the global version:
```bash
asdf global erlang 21.1
asdf global elixir 1.7.4
```
Now you can open a new terminal and try `erl`:
```
$ erl
Erlang/OTP 21 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V9.3 (abort with ^G)
1>
```
Or start Erlang Observer by `erl -s observer start`.
And you can try 'iex':
```bash
$ iex
Erlang/OTP 21 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
```
Use `asdf` `.tool-versions` file to manage which version is active on each of your projects.
Enjoy!
以上是关于markdown Elixir安装指南的主要内容,如果未能解决你的问题,请参考以下文章