Erlang Build Tools--系列3

本文介绍如何安装和构建rebar,一个用于构建OTP-compliant应用的工具。首先需要安装Erlang R13B03或更高版本及Mercurial客户端。然后下载rebar源码包并解压,运行bootstrap脚本完成构建。

转载:https://bitbucket.org/basho/rebar/wiki/Building

 

Building

Dependencies

To build rebar you will need a working installation of Erlang R13B03 (or later).

Should you want to clone the Basho rebar repository , you will also require the Mercurial client (version 1.4 or later). Mercurial source and binary packages can be found here: http://mercurial.selenic.com/wiki/Download?action=show&redirect=BinaryPackages .

Downloading

Download either the tip or RELEASE-1 source package from the Downloads page.

Here, we use wget to download the tip:

1


$
 wget http://hg.basho.com/rebar/get/tip.tar.bz2

Building rebar


$
 tar -xvf tip.tar.bz2
$ cd rebar/
$ ./bootstrap
Recompile: src/getopt
...
Recompile: src/rebar_utils
==> rebar (compile)
Congratulations! You now have a self-contained script called "rebar" in
your current working directory. Place this script anywhere in your path
and you can use rebar to build OTP-compliant apps.

As the console listing indicates, you now have a rebar escript which you can now copy to your project directory, and get rebarized !

 

### 如何下载 Erlang 25 for Linux 安装包 为了获取适用于 Linux 系统的 Erlang 25 安装包,可以遵循以下方法: #### 方法一:通过官方仓库安装 Erlang Solutions 提供了一个方便的方法来安装最新版本的 Erlang。以下是具体操作步骤: 1. **添加 Erlang 解决方案存储库** 需要先将 Erlang 的官方软件包管理器添加到系统中。运行以下命令以导入 GPG 密钥并设置存储库: ```bash wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm sudo rpm -Uvh erlang-solutions-1.0-1.noarch.rpm ``` 2. **更新 YUM 或 APT 缓存** 更新系统的包缓存以便能够访问最新的 Erlang 软件包: 对于 CentOS/RHEL/Fedora 用户: ```bash sudo yum makecache ``` 对于 Ubuntu/Debian 用户: ```bash sudo apt update ``` 3. **安装 Erlang 25** 使用 `yum` 或 `apt-get` 命令安装特定版本的 Erlang(如果支持): ```bash sudo yum install esl-erlang=1:25* # For RPM-based systems sudo apt-get install esl-erlang=1:25* # For Debian-based systems ``` 如果无法找到确切匹配的版本号,则可以通过以下方式查询可用版本列表: ```bash yum list available | grep esl-erlang # For RPM-based systems apt-cache policy esl-erlang # For Debian-based systems ``` #### 方法二:手动下载并编译源代码 当需要更精确控制 Erlang 的构建选项或者目标平台不被官方预编译包覆盖时,可以选择从源代码进行安装。 1. **准备开发工具链** 确保已安装必要的依赖项,例如 GCC 和 Make 工具集: ```bash sudo yum groupinstall "Development Tools" # For RPM-based systems sudo apt-get install build-essential # For Debian-based systems ``` 2. **下载 Erlang 源代码压缩文件** 访问 [OTP Releases](https://github.com/erlang/otp/releases) 页面,定位至所需版本 (v25.x),点击对应的 tarball 下载链接。 3. **解压与配置** 将下载好的 `.tar.gz` 文件提取出来,并进入其根目录执行如下指令: ```bash ./configure --prefix=/usr/local/erlang \ --enable-hipe \ --enable-threads \ --enable-smp-support \ --enable-kernel-poll \ --without-javac ``` 4. **编译和安装** 进一步完成实际的编译过程以及最终部署工作: ```bash make && sudo make install ``` 5. **验证安装成功与否** 启动 Erlang Shell 来确认一切正常运作无误: ```bash erl ``` 若显示类似下面的信息则表明安装顺利完成[^5]: ``` Erlang/OTP 25 [...] Eshell V... ``` #### 注意事项 某些较老的操作系统可能缺乏对新近版次的支持能力,在这种情况下要么升级基础 OS 到更高版本,要么考虑采用容器化技术如 Docker 实现隔离环境下的定制需求满足[^2]。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值