Installing Erlang and Elixir in Ubuntu 16.10 Yakkety Yak

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