Getting the bits, bit by bit


There are several different methods available for installing REX-Ray. It is written in Go, so there are typically no dependencies that must be installed alongside its single binary file. The manual methods can be extremely simple through tools like curl. You also have the opportunity to perform install steps individually. Following the manual installs, configuration must take place.

We also provide some great automation examples using tools like Ansible and Puppet. These approaches will perform the whole process including configuring the REX-Ray for you.

Manual Installs

Manual installations are in contrast to batch, automated installations.

Make sure that before installing REX-Ray that you have uninstalled any previous versions. A rexray uninstall can assist with this where appropriate.

Following an installation and configuration, you can use REX-Ray interactively through commands like rexray volume. Noticeably different from this is having REX-Ray integrate with Container Engines such as Docker. This requires that you run rexray start or relevant service start command like systemctl start rexray.

Install via curl

The following command will download the most recent, stable build of REX-Ray and install it to /usr/bin/rexray or /opt/bin/rexray. On Linux systems REX-Ray will also be registered as either a SystemD or SystemV service.

There is an optional flag to choose which version to install. Notice how we specify stable, see the additional version names below that are also valid.

curl -sSL | sh -s stable

Install a pre-built binary

There are a handful of necessary manual steps to properly install REX-Ray from pre-built binaries.

  1. Download the proper binary. There are also pre-built binaries available for the various release types.

    Version Description
    Unstable The most up-to-date, bleeding-edge, and often unstable REX-Ray binaries.
    Staged The most up-to-date, release candidate REX-Ray binaries.
    Stable The most up-to-date, stable REX-Ray binaries.
  2. Uncompress and move the binary to the proper location. Preferably /usr/bin should be where REX-Ray is moved, but this path is not required.

  3. Install as a service with rexray install. This will register itself with SystemD or SystemV for proper initialization.

Build and install from source

REX-Ray is also fairly simple to build from source, especially if you have Docker installed:

SRC=$(mktemp -d 2> /dev/null || mktemp -d -t rexray 2> /dev/null) && cd $SRC && docker run --rm -it -e GO15VENDOREXPERIMENT=1 -v $SRC:/usr/src/rexray -w /usr/src/rexray golang:1.5.1 bash -c "git clone -b master . && make build-all”

If you'd prefer to not use Docker to build REX-Ray then all you need is Go 1.5:

# clone the rexray repo
git clone

# change directories into the freshly-cloned repo
cd rexray

# build rexray
make build-all

After either of the above methods for building REX-Ray there should be a .bin directory in the current directory, and inside .bin will be binaries for Linux-i386, Linux-x86-64, and Darwin-x86-64.

[0]akutz@poppy:tmp.SJxsykQwp7$ ls .bin/*/rexray
-rwxr-xr-x. 1 root 14M Sep 17 10:36 .bin/Darwin-x86_64/rexray*
-rwxr-xr-x. 1 root 12M Sep 17 10:36 .bin/Linux-i386/rexray*
-rwxr-xr-x. 1 root 14M Sep 17 10:36 .bin/Linux-x86_64/rexray*

Automated Installs

Because REX-Ray is simple to install using the curl script, installation using configuration management tools is relatively easy as well. However, there are a few areas that may prove to be tricky, such as writing the configuration file.

This section provides examples of automated installations using common configuration management and orchestration tools.


With Ansible, installing the latest REX-Ray binaries can be accomplished by including the codenrhoden.rexray role from Ansible Galaxy. The role accepts all the necessary variables to properly fill out your config.yml file.

Install the role from Galaxy:

ansible-galaxy install emccode.rexray

Example playbook for installing REX-Ray on GCE Docker hosts:

- hosts: gce_docker_hosts
  - { role: emccode.rexray,
      rexray_service: true,
      rexray_storage_drivers: [gce],
      rexray_gce_keyfile: "/opt/gce_keyfile" }

Run the playbook:

ansible-playbook -i <inventory> playbook.yml

AWS CloudFormation

With CloudFormation, the installation of the latest Docker and REX-Ray binaries can be passed to the orchestrator using the 'UserData' property in a CloudFormation template. While the payload could also be provided as raw user data via the AWS GUI, it would not sustain scalable automation.

"Properties": {
  "UserData": {
    "Fn::Base64": {
      "Fn::Join": ["", [
        "#!/bin/bash -xe\n",
        "apt-get update\n",
        "apt-get -y install python-setuptools\n",
        "ln -s /usr/local/lib/python2.7/dist-packages/aws_cfn_bootstrap-1.4-py2.7.egg/init/ubuntu/cfn-hup /etc/init.d/cfn-hup\n",
        "chmod +x /etc/init.d/cfn-hup\n",
        "update-rc.d cfn-hup defaults\n ",
        "service cfn-hup start\n",
        "/usr/local/bin/cfn-init --stack ", {
          "Ref": "AWS::StackName"
        }, " --resource RexrayInstance ", " --configsets InstallAndRun --region ", {
          "Ref": "AWS::Region"
        }, "\n",

        "# Install the latest Docker..\n",
        "/usr/bin/curl -o /tmp/\n",
        "chmod +x /tmp/\n",

        "# add the ubuntu user to the docker group..\n",
        "/usr/sbin/usermod -G docker ubuntu\n",

        "# Install the latest REX-ray\n",
        "/usr/bin/curl -ssL -o /tmp/\n",
        "chmod +x /tmp/\n",
        "chgrp docker /etc/rexray/config.yml\n",

Docker Machine (VirtualBox)

SSH can be used to remotely deploy REX-Ray to a Docker Machine. While the following example used VirtualBox as the underlying storage platform, the provided config.yml file could be modified to use any of the supported drivers.

  1. SSH into the Docker machine and install REX-Ray.

    $ docker-machine ssh testing1 \
    "curl -sSL | sh -"
  2. Install the udev extras package. This step is only required for versions of boot2docker older than 1.10.

    $ docker-machine ssh testing1 \
    "wget \
    && tce-load -i udev-extra.tcz && sudo udevadm trigger"
  3. Create a basic REX-Ray configuration file inside the Docker machine.

    Note: It is recommended to replace the volumePath parameter with the local path VirtualBox uses to store its virtual media disk files.

    $ docker-machine ssh testing1 \
        "sudo tee -a /etc/rexray/config.yml << EOF
          - virtualbox
              preempt: false
          tls: false
          volumePath: /Users/YourUser/VirtualBox Volumes
          controllerName: SATA
  4. Finally, start the REX-Ray service inside the Docker machine.

    $ docker-machine ssh testing1 "sudo rexray start"

OpenStack Heat

Using OpenStack Heat, in the HOT template format (yaml):

    type: OS::Nova::Server
      user_data_format: RAW
          template: |
            #!/bin/bash -v
            /usr/bin/curl -o /tmp/
            chmod +x /tmp/
            /usr/sbin/usermod -G docker ubuntu
            /usr/bin/curl -ssL -o /tmp/
            chmod +x /tmp/
            chgrp docker /etc/rexray/config.yml
            dummy: ""


Using Vagrant is a great option to deploy pre-configured REX-Ray nodes, including Docker, using the VirtualBox driver. All volume requests are handled using VirtualBox's Virtual Media.

A Vagrant environment and instructions using it are provided here.