安装 ErlangOTP 环境
Summary: Author: 张亚飞 | Read Time: 2 minute read | Published: 2017-09-08
Filed under
—
Categories:
DevOps
—
Tags:
Linux,
Server,
Software,
DevOps,
Erlang 之 OTP 安装管理及环境配置
Ubuntu 下安装 otp
安装依赖
sudo apt install g++ gcc make libncurses5-dev libssl-dev
因为我们项目并没用Java作为NIF,所以不需要安装Java,有需要的就先安装Java;同时因为服务器只有命令行,不需要wx这个图形库.
编译安装,执行失败可分步执行
cd /opt/data
wget http://erlang.org/download/otp_src_20.2.tar.gz
tar zxvf otp_src_20.2.tar.gz
./configure
sudo make -j4
sudo make install
这样 Erlang 就安装好了.可以输入命令 erl 测试是否安装好
注 实际安装不添加 ./configure –prefix=/opt/otp/ ,将 otp 安装到默认系统位置,否则运行 rebar 或安装 Ejabberd 会出现莫名奇妙的错误,以下记录忽略
指定 prefix ,是为了删除方便.同时在 ~/.bashrc 将 /opt/otp/bin 添加到 PATH.
export PATH=/opt/otp/bin:$PATH
使用一下命令重载配置
source ~/.bashrc
升级
升级重新下载最新版即可 otp_src_xxx.tar.gz 以上步骤重新执行一遍
Window 下安装及环境配置
下载 http://www.erlang.org/download/otp_win64_18.2.1.exe
安装到一个目录 G:\Program Files\erl7.2.1
添加 G:\Program Files\erl7.2.1\bin 到环境变量 PATH
重新打开终端 输入 erl 测试
###Erlang 开发工具
安装插件 intellij-erlang ,Plugins 搜索 erlang
参考列表
错误分析
- 运行
rebar
出现如下错误:
Sun Dec 20 21:15:31 coam@coam:~/RunProject/ejabberd$ sudo ./rebar get-deps
/usr/bin/env: escript: No such file or directory
Sun Dec 20 21:22:50 coam@coam:~/RunProject$ whereis escript
escript: /opt/otp/bin/escript
原因是我安装 otp
时 使用命令 ./configure --prefix=/opt/otp/
指定安装 otp
到 /opt/otp/
下
于是重新安装 otp
,并取消 ~/.bashrc
中配置的 erlang
环境变量
# Erlang
#export PATH=/opt/otp/bin:$PATH
重启 ubuntu
后敲 erl
命令提示未找到,注释成功,重新使用默认参数安装 otp
源码编译安装 Ejabberd
,执行命令 ejabberd ./configure
后出现如下错误:
Sun Dec 20 21:21:26 coam@coam:~/RunProject/ejabberd$ sudo ./configure
checking whether make sets $(MAKE)... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for a sed that does not truncate output... /bin/sed
checking for erl... no
checking for erlc... no
checking for erl... no
configure: error: Erlang/OTP interpreter (erl) not found but required
解决方案,重新安装 otp
到系统默认路径
Comments