Installing Erlang and Elixir in Ubuntu 16.10 Yakkety Yak

Update: I’ve now installed what I believe are the latest stable releases of Erlang, Elixir and Phoenix, and my notes are posted below.

I am still not sure what the difference between the erlang and esl-erlang packages are.


Hello. I’d like to install up-to-date versions of Erlang and Elixir in Ubuntu using repositories so that I can start to try using the Phoenix framework (and learning Elixir/some functional programming!).

Following the instructions here, I first tried to install the https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb package, which said it couldn’t find the system codename and prompted for a system codename input. I cancelled out of the config and purged the deb. The second time I tried, it didn’t say it couldn’t find the system codename but after an apt-get update, apt-cache policy erlang (and elixir and esl-erlang) still only showed the archive.ubuntu.com sources (or none at all in the case of esl-erlang).

At https://packages.erlang-solutions.com/erlang/ there are instructions to install the repositories manually, and I added deb https://packages.erlang-solutions.com/ubuntu yakkety contrib to /etc/apt/sources.list.d/erlang-solutions.list. Doing an apt-get update showed:

Get:8 https://packages.erlang-solutions.com/ubuntu yakkety Release [2,538 B]
Get:9 https://packages.erlang-solutions.com/ubuntu yakkety Release.gpg [836 B]
Get:10 https://packages.erlang-solutions.com/ubuntu yakkety/contrib i386 Packages [18.3 kB]
Get:11 https://packages.erlang-solutions.com/ubuntu yakkety/contrib amd64 Packages [18.3 kB]

Results:

$ apt-cache policy esl-erlang
esl-erlang:
  Installed: (none)
  Candidate: 1:19.1.5
  Version table:
     1:19.1.5 500
        500 https://packages.erlang-solutions.com/ubuntu yakkety/contrib amd64 Packages
     1:19.1.3 500
        500 https://packages.erlang-solutions.com/ubuntu yakkety/contrib amd64 Packages
     1:18.3.4 500
        500 https://packages.erlang-solutions.com/ubuntu yakkety/contrib amd64 Packages

$ apt-cache policy erlang
erlang:
  Installed: (none)
  Candidate: 1:19.1-1
  Version table:
     1:19.1-1 500
        500 https://packages.erlang-solutions.com/ubuntu yakkety/contrib amd64 Packages
        500 https://packages.erlang-solutions.com/ubuntu yakkety/contrib i386 Packages
     1:18.3.4.4+dfsg-1ubuntu2 500
        500 http://de.archive.ubuntu.com/ubuntu yakkety/universe amd64 Packages
        500 http://de.archive.ubuntu.com/ubuntu yakkety/universe i386 Packages
     1:18.3-1 500
        500 https://packages.erlang-solutions.com/ubuntu yakkety/contrib amd64 Packages
        500 https://packages.erlang-solutions.com/ubuntu yakkety/contrib i386 Packages

$ apt-cache policy elixir
elixir:
  Installed: (none)
  Candidate: 1.2.6-1
  Version table:
     1.2.6-1 500
        500 http://de.archive.ubuntu.com/ubuntu yakkety/universe amd64 Packages
        500 http://de.archive.ubuntu.com/ubuntu yakkety/universe i386 Packages

While ‘esl-erlang’ and ‘erlang’ have versions from the erlang-solutions repository, ‘elixir’ doesn’t. Am I right in thinking that it should have a version 1.3 from the erlang-solutions repository? Here there are ‘yakkety’ debs listed for erlang- but not elixir-.

There is a elixir_1.3.4-1~ubuntu~xenial_amd64.deb package listed .

There’s also a ‘Ubuntu Yakkety (64-bit)’ deb package available for direct download at https://packages.erlang-solutions.com/erlang/ - would it be worth installing that or is it better to stick to the repository approach (if that will be made to provide the most recent official release of Elixir) for updates?

Thanks.

1 Like

After you’ve installed Erlang successfully I strongly suggest you to try installing it with asdf.

3 Likes

I installed it on Ubuntu 16.04, with no issues at all. Could it be different with 16.10? :confused:

So, this method is better than official tutorial?

1 Like

I find it better to keep different versions of Elixir installed, updating to new ones with just 2 commands is pretty cool.

1 Like

Why I never see this before… :frowning:
Thanks anyway!

1 Like

Hmm, there is a elixir_1.3.4-1~ubuntu~xenial_amd64.deb (16.04), but no elixir deb for yakkety (16.10).

Wow, that looks useful for several languages. At the moment I do quite like the idea of simply having the latest official release as I’m only going to be learning/tinkering, so I’m still interested in getting 1.3 from the repository if possible. (And presumably being able to upgrade with apt-get upgrade when a new version is released?) But I’ll definitely keep asdf in mind in case that’s not possible and for when I do want different versions. Thanks.

1 Like

I didn’t realize they had packages for 16.04. I’ve been using the packages for 14.04 on 16.10 for months without issue. :laughing:

1 Like

Yeah you were right… :frowning:
Why is this happening… :pensive:

I also found this (kiex), hope it’s helpful

2 Likes

Thanks for the links to asdf and kiex. I’m thinking I may as well go ahead with installing Erlang from the erlang-solutions repository and then install the latest release of Elixir via one of those two methods.

I’ve now installed esl-erlang with apt-get - is that preferable to erlang? (I’m mostly interested in web development but realise I’ll need to learn about Elixir, not just Phoenix.)

1 Like

My 2 cents. If it’s just for your own use, it’s far simpler to just download the erlang src and build it for Debian flavors of Linux.

1 Like

Hi,

my notes for installing Elixir on Ubuntu 16.04 and 16.10:

Perhaps these might help.

Regards Rudolf

1 Like

Phoenix is now running. :slight_smile: I went with asdf for Elixir.

One question I still have is the difference between the packages erlang and esl-erlang. I find the relevant text from the erlang-solutions download page (quoted below) confusing.

Both packages are installed from the erlang-solutions repository. erlang is 19.1-1, and esl-erlang is 19.1.5. It’s for web development that I’m looking to learn about Elixir and Phoenix. I understand that using the esl-erlang package can result in related programs failing to run ‘erlang’; does this matter when not writing Erlang and only writing Elixir/Elixir in Phoenix? Disk space isn’t an issue.

1. What is the erlang package?

Erlang/OTP Platform is a complex system composed of many smaller applications (modules). Installing the erlang package automatically installs the entire OTP suite. Since some of the more advanced users might want to download only a specific selection of modules, Erlang/OTP has been divided into smaller packages (all with the prefix erlang-) that can be installed without launching the erlang package.

2. What is esl-erlang, how is it different from erlang? Have you removed it from repositories?

The esl-erlang package is a file containg the complete installation: it includes the Erlang/OTP platform and all of its applications. The erlang package is a frontend to a number of smaller packages. Currently we support both erlang and esl-erlang.

Note that the split packages have multiple advantages:

  • seamless replacement of the available packages,
  • other packages have dependencies on erlang, not esl-erlang,
  • if your disk-space is low, you can get rid of some unused parts; erlang-base needs only ~13MB of space.

5. Does the erlang package install everything I need for Erlang programming?

No, there are three additional packages:

  • erlang-doc — HTML/PDF documentation,
  • erlang-manpages — manpages,
  • erlang-mode — major editing mode for Emacs.

Okay, thanks. (I’d already started using asfd when I saw your message, and I’m not very experienced with building from source.)

Thanks for that. It may well be useful to refer to, though I’ll stick to the package + asdf-based approach for now as it’s now set up. I’m also using the webupd8team’s Atom PPA.

1 Like

Yesterday I’m trying to setup Elixir on fresh 16.10… My first issue is, erlang-esl is not avialable, so I installed erlang instead. Not sure what the difference is and how it will affect phoenix, but I installing it anyway.

Apparently, after that I can install Elixir with no issue at all :confused: … But the version of it is very old (1.2.4). So I decided to try Kiex, and now running the latest Elixir. Asdf not working for me for some reason I dont know why… This is wierd :confused:

1 Like

I believe the package name is esl-erlang, not erlang-esl. Did you install the erlang-solutions repositories before installing with apt-get? (I still don’t know the difference between erlang and esl-erlang. :slight_smile: )

Regarding asdf, I found that sourcing .bashrc after it had been added to wasn’t in the instructions. I don’t know if that could be why it didn’t seem to work for you?

In case they’re of use to anyone else, here are my notes on the process I ended up with.


Install Erlang (and maybe Elixir) from erlang-solutions source repository

Find Ubuntu’s codename with lsb_release -c

Make /etc/apt/sources.list.d/erlang-solutions.list and insert:

deb https://packages.erlang-solutions.com/ubuntu <ubuntu-codename> contrib

Update package index and install Erlang:

sudo apt-get update
sudo apt-get install erlang

Check which version of Elixir would be installed via package:

apt-cache policy elixir

If the version stated is the current release:

sudo apt-get install elixir
elixir -v

If not, install Elixir with asdf.

Install Elixir with asdf (if required)

Check the current asdf documentation for up-to-date instructions. At the time of writing, installing asdf and using it to install Elixir is done as follows.

Install asdf

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.2.0
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
. ~/.bashrc

Install recommended packages

sudo apt-get install automake autoconf libreadline-dev libncurses-dev libssl-dev libyaml-dev libxslt-dev libffi-dev libtool unixodbc-dev

Add the asdf Elixir plugin

asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir

Install Elixir and set it as the current global version

asdf install elixir 1.3.4
asdf global elixir 1.3.4
elixir -v

Install hex, rebar and Phoenix

mix local.hex
mix local.rebar
mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez

Install inotify

sudo apt-get install inotify-tools

Install Node.js (if required)

Node.js is required for asset compilation with Brunch.

See Installing Node.js via package manager.

At time of writing:

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install nodejs
node --version

Install PostgreSQL (if required)

See Ubuntu Wiki: PostgreSQL.

At time of writing:

sudo apt-get install postgresql postgresql-contrib
sudo -u postgres psql postgres

In PostgreSQL, set postgres user password (to something random/secure) and create user for our Phoenix app:

\password postgres
CREATE ROLE hello_phoenix WITH PASSWORD 'hello_phoenix' LOGIN CREATEDB;
\q

Create a new Phoenix project

To test if everything’s ready:

mix phoenix.new hello_phoenix

Update database username and password in the config files with those used when creating the role.

  • hello_phoenix/config/dev.exs
  • hello_phoenix/config/test.exs
cd hello_phoenix
mix ecto.create
mix test
mix phoenix.server
2 Likes

Aha, sorry… Typo :smile:
I did tried to install esl-erlang (following erlang solution guide), but cannot find the packages :confused:

Yes I did

I’m following the exact readme. The error comes when I’m trying to install Elixir : asdf install elixir 1.3.4. The download takes very long time, and then just error.

Thank you! :smiley:

1 Like

The experiment on my 2 newly setup machines is to use asdf for nearly everything. E.g. I use it for ruby, elixir, erlang and node atm and am very happy. I also didn’t install erlang before - all just through asdf :slight_smile:

2 Likes

Looking at my original post again (it now seems so long ago), I think I had the same issue of the erlang-solutions repository not being used after installing the supplied erlang-solutions_1.0_all.deb. As per my notes, I had to manually add the source repositories for yakkety in, for example, /etc/apt/sources.list.d/erlang-solutions.list.

1 Like

asdf-vm/asdf

1 Like