Install Erlang and Elixir in CentOS 7

本文详细介绍如何在CentOS7的64位最小化服务器上安装Erlang和Elixir,包括必要的先决条件安装、Erlang官方仓库的添加、最新Erlang版本的下载与安装,以及通过Erlang shell测试hello_world程序的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值