I wanted to work on a new Phoenix project on an old laptop running Ubuntu 14.04 (I’ve been too lazy to upgrade) the other day, here are the memorable steps of the Phoenix installation process.

I mostly followed the directions in Programming Phoenix, but the docs have a good guide, too.

I already had Elixir 1.3 and Postgres 9.5 installed, but I needed to upgrade node, since my installed version was 0.8.x. I opted to use nvm and followed the instructions from its repo to install nvm and the latest version of node. (There were some warnings about previously installed node packages which I am ignoring and hoping that I won’t need to deal with.)

I then installed inotify-tools using apt, because the Phoenix site told me to.

I wanted to create a basic “Hello, World” project to make sure everything was working, so I followed the “Creating a Throwaway Project” section in Programming Phoenix.

mix phoenix.new hello worked without issue, but mix phoenix.server failed because it couldn’t find rebar. I told mix to install a local copy, which seemed to succeed but the server still didn’t launch. The error message helpfully told me how to fix the problem, though.

==> gettext
Compiling 1 file (.yrl)
could not compile dependency :gettext, "mix compile" failed. You can recompile this dependency with "mix deps.compile gettext", update it with "mix deps.update gettext" or clean it with "mix deps.clean gettext"
==> hello
** (Mix) Could not compile "src/gettext_po_parser.yrl" because the application "parsetools" could not be found. This may happen if your package manager broke Erlang into multiple packages and may be fixed by installing the missing "erlang-dev" and "erlang-parsetools" packages.

I was able to install erlang-dev and erlang-parsetools via apt and the server launched. The standard “Welcome to Phoenix” page rendedered when I visited localhost:4000!

But, I couldn’t connect to postgres.

...
[error] Postgrex.Protocol (#PID<0.2956.0>) failed to connect: ** (Postgrex.Error) FATAL (invalid_password): password authentication failed for user "postgres"
[error] Postgrex.Protocol (#PID<0.2963.0>) failed to connect: ** (Postgrex.Error) FATAL (invalid_password): password authentication failed for user "postgres"
...

I have cobbled together my Postgres environment over the years without ever really knowing what I was doing, so it could be the case that the postgres user would have a password of postgres by default and everything should have worked out of the box. That wasn’t the case on my machine, but it wasn’t too hard to remedy. I used createuser to make a new user (named elixir_hello) and updated config/dev.exs with the new credentials. When that was done, mix ecto.create created the required database and mix phoenix.server ran without any errors in the log.