Some months I received my C.H.I.P. - a 9$ computer with a 1 GHz CPU, 512 MG RAM and built-in WiFi. My plan was to run distributed tasks with Elixir on it. But how did I get there?
Open up C.H.I.P. flasher tool with Chromium/Chrome, install the plugin and afterwards use the tool to flash the latest HEADLESS image on your device. We don't need a GUI eating our precious resources.
After connecting it to a power source (5V micro-USB) and your TV (composite) the little board boots. To connect to your wifi type:
sudo nmcli device wifi connect '(your wifi network name/SSID)' password '(your wifi password)' ifname wlan0
You better run updates first. Seriously. Come back afterwards.
Did updates? Great! Rebooted? Even greater!
C.H.I.P. comes with ssh-server enabled, so there's no need to enable the daemon. You can try to connect to 'chip@chip' (default user + host name) - password 'chip'.
C.H.I.P. utilizes Debian's default repositories for managing packages (Jessie-backports to be specific), but those repositories don't include Elixir unfortunately. Do get it download the official repo-enabling package from Erlang-Solutions:
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 -y install erlang elixir
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)
This warning will appear in your installation when you run
iex, Elixir's interactive shell, for the first time - to fix this install locales, reconfigure your system and reboot again.
sudo apt-get -y install locales && sudo dpkg-reconfigure locales
When asked about the system locale select something which includes UTF-8 in its name.
Erlang-Solutions' repo contains Elixir 1.2.4 or Erlang 18 for ARM. If you want newer versions you gotta compile your stuff by hand. To switch versions in an easy way there's kiex - an Elixir version manager. Kiex need some dependencies so let's install more stuff!
sudo apt-get -y install build-essential git \curl -sSL https://raw.githubusercontent.com/taylor/kiex/master/install | bash -s
Add the following to your .bashrc/.zshrc:
test -s "$HOME/.kiex/scripts/kiex" && source "$HOME/.kiex/scripts/kiex"
Then source "$HOME/.kiex/scripts/kiex" manually or re-login and run kiex:
kiex list known kiex install 1.3.4
EDIT: Last time I checked this (2 month ago) at least the
kerl way of installing Erlang 19.x worked for me. Now it seems to be broken :/
If you want to run Erlang 19.1 instead of 18.3 on your device you must do a little more work. New Erlang versions aren't included in Debian's repos, so you must build it from source. Luckily there's a shell script that does all of the tedious work for you. After installing required dependencies you can follow kerl's usage instructions.
sudo apt-get install -y build-essential autoconf libncurses5-dev libssh-dev unixodbc-dev fop xsltproc KERL_CONFIGURE_OPTIONS="--without-wx --without-javac" kerl build 19.1 19_1 kerl install 19_1 /path/to/install/dir/ . /path/to/install/dir/activate
When installing Erlang be sure to install all the dependencies beforehand!
sudo apt-get install -y build-essential autoconf libncurses5-dev libssh-dev unixodbc-dev fop xsltproc asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git ERLANG_CONFIGURE_OPTIONS="--without-wx --without-javac" asdf install erlang 19.1 asdf install elixir 1.3.4