In this tutorial, we will be discussing about how to install Erlang and Elixir in CentOS 7 minimal server. Before installing them, let us see a brief explanation of each.

About Erlang

Erlang is an open source programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang’s runtime system has built-in support for concurrency, distribution and fault tolerance. It is designed at the Ericsson Computer Science Laboratory.

About Elixir

Elixir is a dynamic, functional language designed for building scalable and maintainable applications. Elixir leverages the Erlang VM, known for running low-latency, distributed and fault-tolerant systems, while also being successfully used in web development and the embedded software domain.

Now, let us start to install Erlang and Elixir in CentOS 7 64bit minimal server.

Prerequisites

Before installing Erlang and Elixir, we need to install the following prerequisites.

yum update
yum install epel-release
yum install gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git wget wxBase.x86_64

Install Erlang

The Erlang version in the official repositories might be older. So, let us download and install the latest Erlang version.

Add Erlang official repository to install the latest Erlang.

To do so, head over to the Erlang repository page, and download the repository depending upon the distribution you use:

Since, we are installing Erlang in CentOS 7, I am going to add the following repository.

wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm

Update the repository lists with command:

yum update

Install Erlang using command:

yum install erlang    (安装erlang从github上下载速度比较慢,最好centos 服务器上安装shadowsocks客户端 参考文章:http://www.cnblogs.com/weifeng1463/p/8931254.html)

That’s it. The latest Erlang version has been installed.

Verify Erlang

Run the following command to verify whether Erlang is installed or not.

erl

Sample output:

Erlang/OTP 18 [erts-7.3] [source-d2a6d81] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.3 (abort with ^G)
1>

If you see the Erlang command prompt, it’s working! To close the shell, just press Ctrl-Ctwice.

Test a sample “hello_world” program in Erlang

Create a new file called “hello.erl”.

vi hello.erl

Add the following lines:

-module(hello).
-export([hello_world/0]).
hello_world() -> io:fwrite("hello, world\n").

Save and close the file.

Enter to Erlang shell with command:

erl

Run the following commands one by one. Don’t forget to add dot (.) at the end of each command:

c(hello).
hello:hello_world().

Sample output:

Install Elixir

Elixir is available in EPEL repository, but it is very outdated. So, in order to install latest version, we will compile and install it from source file.

Please be mindful that before installing Elixir, you must install Erlang first.

Git clone to the Elixir repository:

git clone https://github.com/elixir-lang/elixir.git

The above command will clone the latest version to a folder called elixir in the current working directory. I have

Go to the elixir directory:

cd elixir/

Run the following command to start compiling elixir:

make clean test

Sample output:

[...]
Compiled lib/iex/app.ex
Compiled lib/iex.ex
Compiled lib/iex/autocomplete.ex
Compiled lib/iex/cli.ex
Compiled lib/iex/config.ex
Compiled lib/iex/history.ex
Compiled lib/iex/helpers.ex
Compiled lib/iex/introspection.ex
Compiled lib/iex/remsh.ex
Compiled lib/iex/server.ex
Compiled lib/iex/evaluator.ex
Compiled lib/iex/info.ex
Generated iex app
==> elixir (eunit)
All 194 tests passed. ==> elixir (exunit)
............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. Finished in 126.1 seconds (81.7s on load, 44.3s on tests)
2909 tests, 0 failures Randomized with seed 29478
==> ex_unit (exunit)
.......................................................................................................................................................................................... Finished in 8.0 seconds (6.5s on load, 1.5s on tests)
186 tests, 0 failures Randomized with seed 540622
==> logger (exunit)
........................................................................................ Finished in 4.4 seconds (3.9s on load, 0.4s on tests)
88 tests, 0 failures Randomized with seed 662540
==> mix (exunit)
.................................................................................................................................................................................................................................................................................................................. Finished in 91.0 seconds (14.1s on load, 76.8s on tests)
306 tests, 0 failures Randomized with seed 988584
==> eex (exunit)
....................................................................... Finished in 0.9 seconds (0.8s on load, 0.07s on tests)
71 tests, 0 failures Randomized with seed 955314
==> iex (exunit)
........................................................................................................... Finished in 5.7 seconds (3.3s on load, 2.3s on tests)
107 tests, 0 failures Randomized with seed 128154

If the tests pass, you are done.

Now, It is highly recommended to add Elixir’s bin path to your PATH environment variable. Otherwise, Elixir will not work.

To do so, run the following command:

export PATH="$PATH:/root/elixir/bin"

Here, I have installed elixir on /root/elixir/ location. You must replace this path with your actual Elixir installation path.

Verify Elixir

To verify whether Elixir is installed or not, run:

iex

Sample output:

Erlang/OTP 18 [erts-7.3] [source-d2a6d81] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Interactive Elixir (1.3.0-dev) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>

If you see the Elixir’s shell prompt, congratulations!

Again, to close the Elixir’s shell, just press Ctrl-C twice.

To check Elixir’s version:

elixir --version

Sample output:

Elixir 1.3.0-dev (bbf7a23)

That’s it. We have now successfully setup working Erlang and Elixir development environment in CentOS 7 server.

Cheers!

参考文章:https://www.unixmen.com/install-erlang-elixir-centos-7/

Install Erlang and Elixir in CentOS 7的更多相关文章

  1. CentOS 7.7安装Erlang和Elixir

    安装之前,先看一下它们的简要说明 Erlang Erlang是一种开源编程语言,用于构建对高可用性有要求的大规模可扩展的软实时系统.它通常用于电信,银行,电子商务,计算机电话和即时消息中.Erlang ...

  2. rabbitmq install erlang faild

    我安装的时候莫名的出现这2个错误 No Presto metadata available for rabbitmq-erlangwarning: /var/cache/yum/x86_64/7/ra ...

  3. Install FFMPEG and FFMPEG-PHP in CentOS 6 with Virtualmin

    Install FFMPEG and FFMPEG-PHP in CentOS 6 with Virtualmin  1 year ago -  by Daniel -  howto centos v ...

  4. Erlang 和 Elixir 互相调用 (转)

    lixr设计目标之一就是要确保兼容性,可以兼容Erlang和其生态系统.Elixir和Erlang 都是运行同样的虚拟机平台(Erlang Virtual Machine).不管是在Erlang使用E ...

  5. Erlang 和 Elixir的差异

    原文: http://elixir-lang.org/crash-course.html 函数调用 Elixir允许你调用函数的时候省略括号, Erlang不行. Erlang Elixir some ...

  6. install erlang environment on centos

    #(erlide in linux can't detect the runtime if build from source, but erlang shell works correctly)su ...

  7. [Erlang 0108] Elixir 入门

    Erlang Resources里面关于Elixir的资料越来越多,加上Joe Armstrong的这篇文章,对Elixir的兴趣也越来越浓厚,投入零散时间学习了一下.零零散散,测试代码写了一些,Ev ...

  8. [Erlang 0113] Elixir 编译流程梳理

    注意:目前Elixir版本还不稳定,代码调整较大,本文随时失效      之前简单演示过如何从elixir ex代码生成并运行Erlang代码,下面仔细梳理一遍elixir文件的编译过程,书接上文,从 ...

  9. [Erlang 0112] Elixir Protocols

    Why Elixir   为什么要学习Elixir?答案很简单,为了更好的学习Erlang.这么无厘头的理由? Erlang语法设计几乎没有考虑过取悦开发者,所以学习之初的门槛略高.对于已经克服了最初 ...

随机推荐

  1. UVA 10229 Modular Fibonacci

    斐波那契取MOD.利用矩阵快速幂取模 http://www.cnblogs.com/Commence/p/3976132.html 代码: #include <map> #include ...

  2. python 666

    运行下面代码会输出什么? __builtins__.我们来运行下这行代码看看="666" #!/usr/bin/env python # encoding: utf-8 def _ ...

  3. 【linux高级程序设计】(第十五章)UDP网络编程应用 4

    socket信号驱动 为了使一个套接字能够使用信号驱动I/O,至少需要以下3步操作. 1.安装SIGIO信号 2.套接字的拥有者设定为当前进程.因为SIGIO信号只会送到socket拥有者进程. 通过 ...

  4. 【linux高级程序设计】(第十一章)System V进程间通信 2

    消息队列 消息队列是消息的链式队列,模型如下: 包括两种数据结构: msqid_ds消息队列数据结构 msg消息队列数据结构 struct msg_msg{ struct list_head m_li ...

  5. Selenium2+python自动化5-操作浏览器基本方法【转载】

    前言前面已经把环境搭建好了,这从这篇开始,正式学习selenium的webdriver框架.我们平常说的 selenium自动化,其实它并不是类似于QTP之类的有GUI界面的可视化工具,我们要学的是w ...

  6. UVA Live 6437 Power Plant 最小生成树

    题意: 有许多油井和村庄什么的,让你使得这些村庄能连通一个油井就好了.第一行给你一个数字T代表有T组测试数据,第二行有 M , N , K ,M代表包括油井在内的村庄数,N 代表有N个 两两连通的地方 ...

  7. luogu P3819 松江1843路

    题目描述 涞坊路是一条长L米的道路,道路上的坐标范围从0到L,路上有N座房子,第i座房子建在坐标为x[i]的地方,其中住了r[i]人. 松江1843路公交车要在这条路上建一个公交站,市政府希望让最多的 ...

  8. [USACO17DEC] Barn Painting

    题目描述 Farmer John has a large farm with NN barns (1 \le N \le 10^51≤N≤105 ), some of which are alread ...

  9. BZOJ2038 [2009国家集训队]小Z的袜子(hose)(莫队算法)

    神奇的莫队算法,用来解决可离线无修改的区间查询问题: 首先对原序列进行分块,√n块每块√n个: 然后对所有查询的区间[l,r]进行排序,首先按l所在的块序号升序排序,如果一样就按r升序排序: 最后就按 ...

  10. POJ 2441 Arrange the Bulls(状压DP)

    [题目链接] http://poj.org/problem?id=2441 [题目大意] 每个人有过个喜欢的篮球场地,但是一个场地只能给一个人, 问所有人都有自己喜欢的场地的方案数. [题解] 状态S ...