Install Erlang and Elixir in CentOS 7

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

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>

root@server1:~_011

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:

root@server1:~_012

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值