Install Elixir Phoenix Framework in Ubuntu 20.04 Focal Fossa

Here is a quick steps of Phoenix Framework installation in Ubuntu 20.04 – Focal Fossa ready for website development. In summary, the steps will install the Erlang, Elixir, Phoenix Framework and PostgreSQL.

1. Erlang and Elixir Installation
First, lets install Erlang. When the pop-up of codename appear, please input Ubuntu 20.04 Codename which is “Focal”:

sudo dpkg -i erlang-solutions_1.0_all.deb 
sudo apt-get update
sudo apt-get install erlang
sudo apt-get install elixir
sudo apt-get install git vim

Simple upload file local Phoenix Elixir

There is a lack of information on how to do simple upload form in Phoenix Framework and store file into local storage. Although people recommend using Plug or external libraries, sometimes is useful to understand how essential thing work like upload image or PDF can be done using few Elixir scripts.

In this tutorial, I’m using an example of Hello project from Phoenix’s installation guideline. If you don’t have the project yet, please set-up by yourself since this tutorial does not cover it.

In the beginning, let write a path to access the upload page in the router, “lib/hello_web/router.ex”. Let use “upload” as the access path

  scope "/", HelloWeb do
    pipe_through :browser

    get "/", PageController, :index
    resources "/upload", UploadController, only: [:index, :create]

Phoenix Elixir Installation in Windows 10

Here is the full guide on how to set up and install the latest Phoenix Web Framework and Elixir in Windows 10. In this case, I’m using Windows 10 as my day to day software development environment. Please follow the steps below:

In summary, to build a new Phoenix application, we will need to install a few software :

  • the Erlang VM and the Elixir programming language
  • PostgreSQL as default preferable database
  • Node.JS for assets – which can be opt-out, especially if you are building APIs
  • Phoenix Framework
  • Cmder (my favorite terminal in Windows)