Table of Contents
- Install Erlang
- Install Elixir
- Install Phoenix
- Install Node.js
- Install PostgreSQL
- Install inotify-tools
- Create a Phoenix application
If you are using a different system, please check our other tutorials.
This tutorial will show you how to install Elixir and Phoenix frameworks on An ITWeb.Services Ubuntu 16.04 server instance for development purposes.
- A new IT Web Services Ubuntu 16.04 server instance
- Logged in as a non-root sudo user.
Update the system:
sudo apt-get update
Install Erlang with the following commands:
cd ~ wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb sudo dpkg -i erlang-solutions_1.0_all.deb sudo apt-get update sudo apt-get install esl-erlang
You can verify the installation:
This will take you to the Erlang shell with following output:
Erlang/OTP 21 [erts-10.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe] Eshell V10.1 (abort with ^G) 1>
Press CTRL + C twice to exit the Erlang shell.
Install Elixir with
sudo apt-get install elixir
Now you can verify the Elixir installation:
This will show the following output:
Erlang/OTP 21 [erts-10.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe] Elixir 1.7.3 (compiled with Erlang/OTP 20)
Now you have Elixir 1.7.3 installed on your system.
If we have just installed Elixir for the first time, we will need to install the Hex package manager as well. Hex is necessary to get a Phoenix app running, and to install any extra dependencies we might need along the way.
Type this command to install Hex:
Now we can proceed to install Phoenix:
mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
The recommended way to install Node.js is via
nvm (node version manager).
nvm we run this command:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
To find out the versions of Node.js that are available for installation, you can type the following:
This will output:
Output ... v8.8.1 v8.9.0 (LTS: Carbon) v8.9.1 (LTS: Carbon) v8.9.2 (LTS: Carbon) v8.9.3 (LTS: Carbon) v8.9.4 (LTS: Carbon) v8.10.0 (LTS: Carbon) v8.11.0 (LTS: Carbon) v8.11.1 (LTS: Carbon) v8.11.2 (LTS: Carbon) v8.11.3 (LTS: Carbon) v8.11.4 (LTS: Carbon) -> v8.12.0 (Latest LTS: Carbon) ...
Install the version you would like with the following command:
nvm install 8.12.0
Note: If you would like to use a different version, replace
8.12.0 with the version you would like.
nvm to use the version we just downloaded:
nvm use 8.12.0
Verify node has successfully installed:
You can install PostgreSQL easily using the apt packaging system.
sudo apt-get update sudo apt-get install postgresql postgresql-contrib
Open the PostgreSQL shell:
sudo -u postgres psql
postgres password to a secure password:
After successfully changing the password, you can exit the PostgreSQL shell:
Restart the PostgreSQL service:
sudo systemctl restart postgresql.service
This is a Linux-only filesystem watcher that Phoenix uses for live code reloading:
sudo apt-get install inotify-tools
Create a Phoenix application
Create a new application:
mix phoenix.new ~/phoenix_project_test
If the command returns the following error:
** (Mix) The task "phx.new" could not be found
You can fix it with the following command:
mix archive.install https://raw.githubusercontent.com/phoenixframework/archives/master/phx_new.ez
Now rerun the command to create a test Phoenix app:
mix phoenix.new ~/phoenix_project_test
Change the PostgreSQL password in the config file with the password you set in the previous step:
The application will now be successfully created. Move to the application folder and start it:
cd ~/phoenix_project_test mix ecto.create mix phx.server
Now the Phoenix application is up and running at port
Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!