• 1.
    Install the following packages: build-essential make autoconf libncurses5-dev libkrb5-dev libssl-dev libpam0g-dev default-jre git curl unixodbc-dev bison flex ed libwxgtk3.0-dev dctrl-tools xsltproc libgl1-mesa-dev libgl-dev libglu1-mesa-dev libglu-dev libsctp-dev libxml2-utils fop default-jdk zlib1g-dev libstdc++-8-dev


  • 2. Build OpenSSL 0.9.7 and use "kerl" to download compatible version of Erlang:

    git clone https://github.com/openssl/openssl.git --branch OpenSSL_1_0_2-stable
    cd openssl
    ./config --prefix=/home/riak shared
    make depend && make && make install
    git clone https://github.com/kerl/kerl.git
    KERL_CONFIGURE_OPTIONS=--with-ssl=/home/riak ./kerl build git git://github.com/basho/otp.git
    OTP_R16B02_basho8 R16B02-basho8
    ./kerl install R16B02-basho8 ~/erlang/R16B02-basho8
    . ~/erlang/R16B02-basho8/activate


  • 3. Riak CS depends on two other parts: Riak itself, which is a key/value storage and Stanchion, wchich makes sure all entities are globally unique.
    •   3.1. You need to download Riak from Github:
        
       git clone -b 2.1.1 https://github.com/basho/riak.git

      Branch 2.1.1 is the last version, compatible with stable Stanchion and Riak CS at the moment ( 09/01/2017 ).
    •   3.2. Then get Stanchion:
        
      git clone -b 2.1 https://github.com/basho/stanchion.git

    •   3.3. And finally get Riak CS:
        
      git clone -b 2.1 https://github.com/basho/riak_cs.git

  • 4. Build Riak:

    export LD_LIBRARY_PATH=/home/riak/lib
    . ~/erlang/R16B02-basho8/activate
    cd /path-to/riak/
    make rel


    UPD: You will have to update old links to AWS S3 in grab-solr.sh. Change URLs from "http://s3.amazonaws.com/files.basho.com/solr/$FILENAME" to "https://archive.apache.org/dist/lucene/solr/4.7.0/$FILENAME"
    Use the same command for building Riak CS and Stanchion.

  • 5. Edit Riak configuration files. /path-tp/riak/rel/riak/etc/advanced.config:

    [
    {riak_kv, [
    {add_paths, ["/home/username/src/riak/riak_cs/ebin"]},
    {storage_backend, riak_cs_kv_multi_backend},
    {multi_backend_prefix_list, [{<<"0b-">>, be_blocks}]},
    {multi_backend_default, be_default},
    {multi_backend, [
    {be_default, riak_kv_eleveldb_backend, [
    {total_leveldb_mem_percent, 30},
    {data_root, "/home/username/var/lib/riak/leveldb"}
    ]},
    {be_blocks, riak_kv_bitcask_backend, [
    {data_root, "/home/username/var/lib/riak/bitcask"}
    ]}
    ]}
    ]}
    ].


    /path-to/riak/rel/riak/etc/riak.conf:

    nodename = riak@127.0.0.1
    distributed_cookie = riak
    listener.http.internal = 127.0.0.1:8098
    listener.protobuf.internal = 127.0.0.1:8087
    listener.https.internal = 127.0.0.1:18098
    buckets.default.allow_mult = true


  • 6. Edit Riak CS configuration files.
    /path-to/riak_cs/rel/riak-cs/etc/riak-cs.conf

    listener = 0.0.0.0:8080
    riak_host = 127.0.0.1:8087
    stanchion_host = 127.0.0.1:8085
    stanchion.ssl = off
    anonymous_user_creation = on
    admin.listener = 127.0.0.1:8000
    root_host = s3.amazonaws.com
    nodename = riak-cs@127.0.0.1
    distributed_cookie = riak


    /path-to/riak_cs/rel/riak-cs/etc/advanced.config:

    [
    {riak_cs,
    [
    {auth_v4_enabled, true},
    {enforce_multipart_part_size, false}
    ]}
    ].


  • 7. Start Riak, Stanchion and then Riak CS ( order is important )

    $ ./riak/rel/riak/bin/riak start
    $ ./stanchion/rel/stanchion/bin/stanchion start
    $ ./riak_cs/rel/riak_cs/bin/riak-cs start


  • 8. Add admin user

    curl -v -H 'Content-Type: application/json' -XPOST --data '{"email":"admin@xentime.com", "name":"admin"}' http://127.0.0.1:8000/riak-cs/user


    You should receive the following response:

    {
    "email":"admin@example.com",
    "display_name": "Someone",
    "name": "admin",
    "key_id": "6DAERANB3MA8TCX6XIMR",
    "key_secret": "qzkhdAXunZezfVAuWoxt6yFVVDqe32a4zfy27g",
    "id": "029ee1878f42fa49045d432fa12c6f4e902dee4bca747e4f59daf6bc2d9d3e19",
    "status": "enabled"
    }


  • 9. Turn off anonymous_user_creation in riak_cs.conf:

    anonymous_user_creation = off
    And specify admin identifier (riak_cs.conf and stanchion.conf files):
    admin.key = 6DAERANB3MA8TCX6XIMR
    You can also turn on Riak control panel in riak.conf: riak_control = on
    riak_control.auth.mode = userlist
    riak_control.auth.user.admin.password = qzkhdAXunZezfVAuWoxt6yFVVDqe32a4zfy27g


  • 10. Change limits in /etc/security/limits.conf:

    root soft nofile 65536
    root hard nofile 65536
    xentime soft nofile 65536
    xentime hard nofile 65536

  • 11. Restart Riak, Stanchion and Riak CS.

Riak CS is ready for uploading objects. You can use s3cmd command-line tool for browsing.

~/.s3cfg:

access_key = 6DAERANB3MA8TCX6XIMR
...
proxy_host = 127.0.0.1
proxy_port = 8080
...
secret_key = qzkhdAXunZezfVAuWoxt6yFVVDqe32a4zfy27g