Skip to main content

Riak Core on Partisan on Elixir Tutorial: Setup

Previous post: Riak Core on Partisan on Elixir Tutorial: Introduction.

The Container Way

On the resources folder of civiledb there's a Dockerfile that creates a Docker image with ubuntu 18.04 and all the required dependencies setup, just clone the repo, install docker if you haven't yet and do this once:

cd resources
sudo docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) --build-arg UNAME=$(whoami) -t ubuntu-elixir:1804 ubuntu-1804

Then every time you want to do something with the project, from the root of the project run:

sudo docker run -it -v $PWD:/src -w /home/$(whoami) ubuntu-elixir:1804 bash

It will open a shell inside the ubuntu image with the project mounted in /src.

Install Erlang and rebar3

To start we need to have Erlang and rebar3 installed.

In this tutorial I assume Erlang 22 and rebar3 3.12.0 but it should work with Erlang 21 and newer versions of rebar3.

If you don't have Erlang installed or you don't have problem to install the latest one system wide you can try installing it with your package manager:

  • For Homebrew on OS X: brew install erlang

  • For MacPorts on OS X: port install erlang

  • For Ubuntu and Debian: apt-get install erlang

  • For Fedora: yum install erlang

  • For FreeBSD: pkg install erlang

Please check that the package version is 22.x, if not, check for instructions on how to install the Erlang Solutions package for Ubuntu, CentOS, Mac OS X, Debian or Fedora here:

Setting up rebar3

# download rebar3 to our bin directory
wget -O $HOME/bin/rebar3

# set execution permissions for your user
chmod u+x $HOME/bin/rebar3

You will need to add $HOME/bin to your $PATH if it's not there already, run export PATH=$PATH:$HOME/bin to add it, you will need to run it on every new terminal session or add it to your shell's rc file (.bashrc, .zshrc or similar)

Just in case you have problems running the rebar3 commands with a different version, here's the version I'm using:

rebar3 version


rebar 3.12.0 on Erlang/OTP 22 Erts 10.5

Install Elixir with asdf

Go to, click Get Started and find the best way to start for you, I used this one:

git clone ~/.asdf --branch v0.7.4

Then I installed the elixir plugin:

asdf plugin-add elixir

Then installed Elixir 1.9.1-otp-22:

asdf install elixir 1.9.1-otp-22

On every terminal I want to have this version of elixir available I do:

asdf local elixir 1.9.1-otp-22

To make sure you have everything setup try running:


You should see something like this:

Erlang/OTP 22 [erts-10.5] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Interactive Elixir (1.9.1) - press Ctrl+C to exit (type h() ENTER for help)

Press Ctrl+C twice to exit.

Next post: Riak Core on Partisan on Elixir Tutorial: Getting Started.


Comments powered by Disqus