Ubuntu 18.04 安装erlang、rebar3亲测有效
安装erlang
方法一:在linux下直接安装
运行以下命令直接安装
sudo apt-get install erlang
存在的问题:可能是低版本Erlang。
可运行以下命令查看erlang版本:
erl --version
方法二:通过esl安装
通过方案一安装后升级版本可能需要执行的脚本
sudo apt-get autoremove --purge erlang-base
首先要去Erlang官网下载一个最新的安装包。
不推荐通过apt-get会发现找不到源,或者很久没有更新,安装的都是老旧的。
执行安装操作
1、执行安装操作
dpkg -i esl-erlang_21.0-1_ubuntu_artful_amd64.deb
它会说,我缺少很多相关的依赖。
root@ubuntu:/home/erlang# dpkg -i esl-erlang_21.0-1_ubuntu_artful_amd64.deb
Selecting previously unselected package esl-erlang.
(Reading database … 60202 files and directories currently installed.)
Preparing to unpack esl-erlang_21.0-1_ubuntu_artful_amd64.deb …
Unpacking esl-erlang (1:21.0) …
dpkg: dependency problems prevent configuration of esl-erlang:
esl-erlang depends on libwxbase2.8-0 | libwxbase3.0-0 | libwxbase3.0-0v5; however:
Package libwxbase2.8-0 is not installed.
Package libwxbase3.0-0 is not installed.
Package libwxbase3.0-0v5 is not installed.
esl-erlang depends on libwxgtk2.8-0 | libwxgtk3.0-0 | libwxgtk3.0-0v5; however:
Package libwxgtk2.8-0 is not installed.
Package libwxgtk3.0-0 is not installed.
Package libwxgtk3.0-0v5 is not installed.
esl-erlang depends on libsctp1; however:
Package libsctp1 is not installed.dpkg: error processing package esl-erlang (–install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
esl-erlang
2、 按照要求解决依赖
apt-get install libwxbase3.0-0v5
例如:
root@ubuntu:/home/erlang# apt-get install libwxbase3.0-0v5
Reading package lists… Done
Building dependency tree
Reading state information… Done
You might want to run ‘apt-get -f install’ to correct these:
The following packages have unmet dependencies:
esl-erlang : Depends: libwxgtk2.8-0 but it is not installable or
libwxgtk3.0-0 but it is not installable or
libwxgtk3.0-0v5 but it is not going to be installed
Depends: libsctp1 but it is not going to be installed
Recommends: erlang-mode but it is not going to be installed
E: Unmet dependencies. Try ‘apt-get -f install’ with no packages (or specify a solution).
这个时候你需要执行:
apt-get -f install
然后会让你同意输入一个y。
大概需要五分钟去执行。
3、再次执行安装操作
dpkg -i esl-erlang_21.0-1_ubuntu_artful_amd64.deb
root@ubuntu:/home/erlang# dpkg -i esl-erlang_21.0-1_ubuntu_artful_amd64.deb
(Reading database … 79229 files and directories currently installed.)
Preparing to unpack esl-erlang_21.0-1_ubuntu_artful_amd64.deb …
Unpacking esl-erlang (1:21.0) over (1:21.0) …
Setting up esl-erlang (1:21.0) …
root@ubuntu:/home/erlang#
4、查是否安装成功
erl
这样就安装成功了。
root@ubuntu:/home/erlang# erl
Erlang/OTP 21 [erts-10.0] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]
Eshell V10.0 (abort with ^G)
1>
安装rebar3
下载编译好的版本
wget https://s3.amazonaws.com/rebar3/rebar3
chmod +x /home/hylink/rebar3
./rebar3 local install
设置环境变量,方便使用
gedit ~/.bashrc
source ~/.bashrc
查是否安装成功
rebar3 --version