Installing Erlang

Pre-packaged versions of Riak include an Erlang installation. If you are building Riak from source, you will need to install Riak’s patched version of Erlang. If you do not use this version of Erlang, you will not be able to use Riak’s security features.

Note on Official Support

Please note that only packaged Riak KV installs are officially supported. Visit Installing Riak KV for installing a supported Riak package.

Prerequisites

Contents

To build and install Erlang you must have a GNU-compatible build system and these tools:

Unpacking

  • GNU unzip or a modern uncompressing utility.
  • GNU Tar for working with GNU TAR archives.

Building

  • autoconf: generates configure scripts.
  • make: generates executables and other non-source files of a program.
  • gcc: for compiling C.
  • ncurses: for terminal-based interfaces.
  • OpenSSL: toolkit that implements SSL and TSL protocols.
  • Java SE JDK: platform for deploying Java.

kerl Prerequisites

kerl is the quickest way to install different versions of Erlang on most systems.

Install kerl by running the following command:

curl -O https://raw.githubusercontent.com/spawngrid/kerl/master/kerl
chmod a+x kerl

If you are using Mac OS X, FreeBSD, or Solaris, see the following sections for additional requirements before building with kerl.

Otherwise, continue with Installing with kerl.

Configuring kerl on FreeBSD/Solaris

Start by by creating a ~/.kerlrc file:

touch ~/.kerlrc

Next add the following contents to your ~/.kerlrc file:

KERL_CONFIGURE_OPTIONS="--disable-hipe --enable-smp-support --enable-threads
                        --enable-kernel-poll --without-odbc --enable-darwin-64bit"

Then check for the presence of autoconf by running:

which autoconf

If this returns autoconf not found, install autoconf by running:

sudo pkg update
sudo pkg install autoconf

Once you’ve configured kerl and installed autoconf continue with Installing with kerl.

Configuring kerl on Mac OS X

To compile Erlang as 64-bit on Mac OS X you need to instruct kerl to pass the correct flags to the configure command.

Start by by creating a ~/.kerlrc file:

touch ~/.kerlrc

Next add the following contents to your ~/.kerlrc file:

KERL_CONFIGURE_OPTIONS="--disable-hipe --enable-smp-support --enable-threads
                        --enable-kernel-poll --without-odbc --enable-darwin-64bit"

On OS X 10.9 (Mavericks) or later, you may need to install autoconf.

Check for the presence of autoconf by running:

which autoconf

If this returns autoconf not found, install autoconf with:

With Homebrew:

brew install autoconf

Or with curl:

curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar zxvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure && make && sudo make install

Once you’ve configured kerl and installed autoconf continue with Installing with kerl.

Debian/Ubuntu Prerequisites

Dependencies

To install the required dependencies run the following apt-get commands:

sudo apt-get update
sudo apt-get install build-essential autoconf libncurses5-dev openssl libssl-dev fop xsltproc unixodbc-dev git

GUI Dependencies

If you’re using a graphical environment and want to use Erlang’s GUI utilities, you will need to install additional dependencies.

Note on build output

These packages are not required for operation of a Riak node. Notes in the build output about missing support for wxWidgets can be safely ignored when installing Riak in a typical non-graphical server environment.

To install packages for graphics support use the following apt-get command:

sudo apt-get install libwxbase2.8 libwxgtk2.8-dev libqt4-opengl-dev

Next Steps

Once you’ve installed the prerequisites, continue with Installing on Debian/Ubuntu.

FreeBSD/Solaris Prerequisites

Dependencies

To install the required dependencies run the following pkg command:

sudo pkg update
sudo pkg install gcc autoconf gmake flex

GUI Dependencies

If you’re using a graphical environment and want to use Erlang’s GUI utilities, you will need to install additional dependencies.

To install packages for graphics support use the following pkg command:

sudo pkg install wx28-gtk2-2.8.12_4

Next Steps

Once you’ve installed the prerequisites, continue with Installing on FreeBSD/Solaris.

Mac OS X Prerequisites

First install XCode Developer Tools. XCode is a set software development tools for developing on OS X.

We also recommend installing Homebrew, a package manager for OS X. Homebrew is not required to install Erlang and is optional.

Next, if you are running OS X 10.9 (Mavericks) or later, you may need to install autoconf. To check for the presence of autoconf run:

which autoconf

If this returns autoconf not found, install autoconf with:

With Homebrew:

brew install autoconf

Or with curl:

curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar zxvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure && make && sudo make install

Once you’ve installed the prerequisites continue with Installing on Mac OS X.

RHEL/CentOS Prerequisites

Dependencies

To install the required dependencies run the following yum command:

sudo yum install gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git

GUI Dependencies

If you’re using a graphical environment and want to use Erlang’s GUI utilities, you will need to install additional dependencies.

To install packages for graphics support use the following blank command:

sudo yum install wxBase.x86_64

Next Steps

Once you’ve installed the prerequisites, continue with Installing on RHEL/CentOS.

Installation

Installing with kerl

First make sure you have installed the necessary dependencies and prerequisites found in kerl Prerequisites.

With kerl installed, you can install Riak’s recommended version of Erlang from Github using the following command:

./kerl build git git://github.com/basho/otp.git OTP_R16B02_basho8 R16B02-basho8

This builds the Erlang distribution and performs all of the steps required to manually install Erlang for you.

After Erlang is successfully built, you can install the build as follows:

./kerl install R16B02-basho8 ~/erlang/R16B02-basho8
. ~/erlang/R16B02-basho8/activate

The last line activates the Erlang build that was just installed into ~/erlang/R16B02-basho8.

See the kerl README for more details on the available commands.

Confirm Erlang installed to the correct location:

which erl

And start Erlang from your terminal with:

erl

Installing on Debian/Ubuntu

First make sure you have installed the necessary dependencies found in Debian/Ubuntu Prerequisites.

Next download Riak’s patched version of Erlang.

Using wget:

wget http://s3.amazonaws.com/downloads.riak.com/erlang/otp_src_R16B02-basho8.tar.gz

Then unpack the download with:

tar zxvf otp_src_R16B02-basho8.tar.gz

Next cd into the unpacked directory, build and install Erlang with:

cd OTP_R16B02_basho8
./otp_build autoconf
./configure && make && sudo make install

Confirm Erlang installed to the correct location:

which erl

And start Erlang from your terminal with:

erl

Installing on FreeBSD/Solaris

First make sure you installed the necessary dependencies in FreeBSD/Solaris Prerequisites.

Next download Riak’s patched version of Erlang:

ftp http://s3.amazonaws.com/downloads.riak.com/erlang/otp_src_R16B02-basho8.tar.gz

Then unpack the download with:

tar zxvf otp_src_R16B02-basho8.tar.gz

Next cd into the unpacked directory, build and install Erlang with:

cd OTP_R16B02_basho8
./otp_build autoconf
./configure && gmake && sudo gmake install

Confirm Erlang installed to the correct location by running:

which erl

And start Erlang from your terminal with:

erl

Installing on Mac OS X

First make sure you have installed the necessary dependencies found in Mac OS X Prerequisites.

You can install Erlang in several ways on OS X:

Installing on Mac OS X from Source

Next download Riak’s patched version of Erlang:

curl -O http://s3.amazonaws.com/downloads.riak.com/erlang/otp_src_R16B02-basho8.tar.gz

Then unpack the download with:

tar zxvf otp_src_R16B02-basho8.tar.gz

Follow the steps below to configure Erlang for your operating system.

Configuring Erlang on Mavericks (OS X 10.9), Mountain Lion (OS X 10.8), and Lion (OS X 10.7)

If you’re on Mavericks (OS X 10.9), Mountain Lion (OS X 10.8), or Lion (OS X 10.7) you can use LLVM (the default) or GCC to compile Erlang.

Using LLVM:

CFLAGS=-O0 ./configure --disable-hipe --enable-smp-support --enable-threads \
--enable-kernel-poll --enable-darwin-64bit

Or if you prefer GCC:

CC=gcc-4.2 CPPFLAGS='-DNDEBUG' MAKEFLAGS='-j 3' \
./configure --disable-hipe --enable-smp-support --enable-threads \
--enable-kernel-poll --enable-darwin-64bit

Configuring Erlang on Snow Leopard (OS X 10.6)

If you’re on Snow Leopard (OS X 10.6) or Leopard (OS X 10.5) with an Intel processor:

./configure --disable-hipe --enable-smp-support --enable-threads \
--enable-kernel-poll  --enable-darwin-64bit

Configuring Erlang on older versions of OS X

If you’re on a non-Intel processor or older version of OS X:

./configure --disable-hipe --enable-smp-support --enable-threads \
--enable-kernel-poll

After you’ve configured your system cd into the unpacked directory, build and install Erlang with:

cd OTP_R16B02_basho8
./otp_build autoconf
./configure && make && sudo make install

Confirm Erlang installed to the correct location by running:

which erl

And start Erlang from your terminal with:

erl

Installing on Mac OS X with Homebrew

To install Erlang with Homebrew, use this command:

brew install erlang

Confirm Erlang installed to the correct location by running:

which erl

And start Erlang from your terminal with:

erl

Installing on Mac OS X with MacPorts

Installing with MacPorts:

port install erlang +ssl

Confirm Erlang installed to the correct location by running:

which erl

And start Erlang from your terminal with:

erl

Installing on RHEL/CentOS

First make sure you have installed the necessary dependencies and prerequisites found in RHEL/CentOS Prerequisites.

Using wget:

wget http://s3.amazonaws.com/downloads.riak.com/erlang/otp_src_R16B02-basho8.tar.gz

Then unpack the download with:

tar zxvf otp_src_R16B02-basho8.tar.gz

Next cd into the unpacked directory, build and install Erlang with:

cd OTP_R16B02_basho8
./otp_build autoconf
./configure && make && sudo make install

Note for RHEL6/CentOS6

In certain versions of RHEL6 and CentO6 the openSSL-devel package ships with Elliptical Curve Cryptography partially disabled. To communicate this to Erlang and prevent compile- and run-time errors, the environment variable CFLAGS="-DOPENSSL_NO_EC=1" needs to be added to Erlang’s ./configure call.

The full make invocation then becomes

CFLAGS="-DOPENSSL_NO_EC=1" ./configure && make && sudo make install

Confirm Erlang installed to the correct location:

which erl

And start Erlang from your terminal with:

erl