m-onz

m-onz : tech, art & musings

install elixir otp & phoenix on linux mint

This is a guide to install erlang & OTP as well as elixir on Linux Mint at a sufficiently high enough versions to be able to use phoenix.

Uninstalling the current Erlang and Elixir: #

sudo apt-get remove --purge erlang elixir
sudo apt-get autoremove

This will uninstall Erlang and Elixir and also remove any additional packages that were installed with them but are no longer used.

Install Erlang Solutions' OTP 24: #

First, you'll want to add the Erlang Solutions repository and register its public key:


wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb
sudo dpkg -i erlang-solutions_2.0_all.deb

Now, update your local package database:


sudo apt-get update

Install the Erlang/OTP package: #


sudo apt-get install esl-erlang

Verify that the right version is installed:


erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().'  -noshell

Installing Elixir from source: #

First, you'll need git and some building tools if you don't already have them:


sudo apt-get install git make

Now, clone the Elixir repo and build it:


git clone https://github.com/elixir-lang/elixir.git
cd elixir
make
sudo make install

Add the Elixir bin directory to your PATH. #

Edit your shell profile (like .bashrc or .zshrc) and add:


export PATH="$PATH:/path/to/elixir/bin"
Replace /path/to/elixir with the actual path to where you cloned Elixir.

Verify Elixir installation: #


elixir -v

install inotify-tools #

sudo apt-get install inotify-tools

install postgres #

sudo apt-get install postgresql postgresql-contrib

Start the PostgreSQL service:


sudo service postgresql start

Reset the PostgreSQL postgres user password: #

Access the PostgreSQL command line interface:


sudo -u postgres psql

Set a new password for the postgres user: #


ALTER USER postgres WITH PASSWORD 'newpassword';

Replace 'newpassword' with your desired password. Then, exit the PostgreSQL command line:

\q

Remember to configure your database within phoenix applications eg: config/dev.exs

install phoenix #

mix local.hex
mix archive.install hex phx_new

If you don't plan to use databases in your application, you can pass the --no-ecto flag.

start the phoenix server #

mix phx.server

And that's it! You should now have Erlang Solutions' OTP 24 and the latest Elixir installed from source on your system. This should mean that you will have no issues running phoenix