# Ubuntu 用Kerl安装及管理Erlang

1.安装依赖

apt-get install libssl-dev make gcc automake autoconf libncurses5-dev
1
apt-get install unixodbc
1
apt-get install unixodbc-dev
1
apt-get install wget
1

2.安装kerl

root@SummerGao:/home/summergao#
1
cd /home/summergao/kerl
1
curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
1
chmod a+x kerl
1

配种环境变量

export PATH=$PATH:/home/summergao/kerl
1

查看环境变量

 echo $PATH
1

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/summergao/

3.查看可安装的erlang版本

kerl list releases
1

R10B-0
R10B-10
R10B-1a
R10B-2
R10B-3
R10B-4
R10B-5
R10B-6
R10B-7
R10B-8
R10B-9
R11B-0
R11B-1
R11B-2
R11B-3
R11B-4
R11B-5
R12B-0
R12B-1
R12B-2
R12B-3
R12B-4
R12B-5
R13A
R13B01
R13B02-1
R13B02
R13B03
R13B04
R13B
R14A
R14B01
R14B02
R14B03
R14B04
R14B
R14B_erts-5.8.1.1
R15B01
R15B02
R15B02_with_MSVCR100_installer_fix
R15B03-1
R15B03
R15B
R16A_RELEASE_CANDIDATE
R16B01
R16B02
R16B03-1
R16B03
R16B
17.0-rc1
17.0-rc2
17.0
17.1
17.3
17.4
17.5
18.0
18.1
18.2
18.2.1
18.3
19.0
19.1
19.2
19.3
20.0
20.1
20.2
20.3
21.0
21.1
21.2
21.3
22.0-rc1
22.0-rc2
22.0-rc3
22.0

Run '/home/summergao/kerl update releases' to update this list from erlang.org

4.下载指定release包并编译

kerl build 22.0 22.0
1

要从官网上下70M的东西,erlang.org对中国区本来就慢,建议使用git源(KERL_BUILD_BACKEND=git)

KERL_BUILD_BACKEND=git
1

5.查看是否build成功

 kerl list builds
1

root@SummerGao (opens new window):~/.kerl/builds#  kerl list builds
22.0,22.0

6.查看状态

kerl status
1

root@SummerGao (opens new window):~/.kerl/builds# kerl status
Available builds:
22.0,22.0
----------
Available installations:
There are no installations available
----------
No Erlang/OTP installation is currently active

7.安装

kerl install 22.0 ~/kerl/22.0
1

Installing Erlang/OTP 22.0 (22.0) in /root/kerl/22.0...

You can activate this installation running the following command:
. /root/kerl/22.0/activate
Later on, you can leave the installation typing:
kerl_deactivate

8.查看安装路径

kerl list installations
1

9.激活

. /root/kerl/22.0/activate
1

激活将备份您的$ PATH,并将其添加到安装的bin /目录中。因此,它仅对当前shell会话有效,直到您激活另一个安装或调用kerl_deactivate。

10.查看已激活的版本

kerl active
1

root@SummerGao (opens new window):/home/gaozheng# kerl active
The current active installation is:
/root/kerl/22.0

10.运行erl

erl
1

root@SummerGao (opens new window):~/kerl/22.0# erl
Erlang/OTP 22 [erts-10.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Eshell V10.4  (abort with ^G)
1>

11.安装结束

更多请移步:https://github.com/kerl/kerl (opens new window)

参考:https://www.cnblogs.com/zhongwencool/p/erlang_kerl.html (opens new window)

Last Updated: 4/23/2021, 12:47:12 PM