Chapter 1. Obtaining and Installing LogicBlox

There are various ways to install LogicBlox: if you have a machine running a 64-bit flavor of Linux or MacOS X, you can install it natively. Alternatively, you can run LogicBlox using the popular Vagrant tool. This chapter describes how to install LogicBlox using either method.

1.1. Install LogicBlox Natively (64-bit Linux or Mac OSX 10.10+)

If you run a 64-bit flavor of Linux or Mac OSX 10.10+, you can install LogicBlox natively on your machine.

System requirements

  • A 64-bit flavor of Linux or Mac OSX 10.10+. Verify that you're running 64-bit Linux by running: uname -m which should return x86_64.

  • At least 8GB of available memory.

  • Python 2.7 or newer (but not Python 3.x). Available from the Python Website.

  • Java Developer Kit version 8 or newer. Available from Oracle's Java website.

Installation steps

  • Download the latest LogicBlox tarball from the LogicBlox release page.

  • Extract the tarball (tar xzf LogicBlox-4.*.tar.gz).

  • The archive contains a script to set up all the environment variables required to run LogicBlox. Before using LogicBlox you must source this script, as follows:

    $ source logicblox-4.*/etc/profile.d/logicblox.sh

    Tip

    For convenience, you may want to add this line to your shell's startup script, e.g., to ~/.bash_profile or ~/.bashrc.

1.2. Install LogicBlox Using Vagrant (Mac, Linux, Windows)

Vagrant is a popular tool that can be used to easily set up development environments for projects with complex dependencies. Vagrant will automatically create, provision and manage a Linux virtual machine (VM) that contains all the dependencies required for each project. It will mount your project directory into the VM, which allows you to use your favorite editors to edit LogiQL code outside of the VM, and compile and test your project inside the VM.

System requirements

  • Mac OS X, Linux or Windows capable of running VirtualBox.

  • At least 8GB of available memory.

Installation steps

  • Download the latest LogicBlox tarball from the LogicBlox release page.

  • Download and install VirtualBox for your platform.

  • Download and install Vagrant for your platform.

  • For each project you're likely to work on:

    • Create a directory for your LogicBlox project.

    • Copy (or hardlink) the LogicBlox tarball you downloaded into this directory.

    • Download the latest version of the LogicBlox Vagrant file into this directory, e.g., using CURL (Mac/Linux): curl -O https://bitbucket.org/logicblox/lb-vagrant/raw/tip/Vagrantfile

    • Open a terminal (command line window) and cd into your project directory, then run:

      $ vagrant up

      This will create an Ubuntu Linux VM, install LogicBlox into it and start the LogicBlox automatically.

    • To run LogicBlox commands, login to the VM using SSH:

      $ vagrant ssh

      Vagrant on Windows

      vagrant ssh will not work out-of-the-box on Windows. To set it up, follow these instructions. Alternatively, you can choose to ignore those instruction and run only single commands via SSH, which works great on Windows. See "Vagrant Tips" below on how to do this.

When you're not logged into the VM via SSH, the VM will still keep running. To clean it up you can either stop it or destroy it (note that destroying is perfectly OK because project files are not stored in the VM itself).

To delete your development VM:

$ vagrant destroy

To stop it (can be started later again with vagrant up):

$ vagrant halt

Accessing Logs and Configuration

After you run vagrant up, a directory called lb_deployment is created within your project. Among its subdirectories are logs and config. These contain the current logs and configuration of the running LB instance. You can change the configuration and restart LB to let the changes take effect.

Accessing LB Web

Vagrant automatically maps your VM's port 8080 and 8086 to your host's port 8080 and 8086. As a result, you can access LB web via http://localhost:8080 as if you were running it natively. However, if port 8080 was already in use when you ran vagrant up, it will have picked another port automatically. Watch the vagrant up output for lines like:

Fixed port collision for 8080 => 8080. Now on port 8081.

to see what the port was mapped to.

Vagrant tips

  • If you only want to run a single command within the VM, you can use:

    $ vagrant ssh -c 'your command'

    For instance:

    $ vagrant ssh -c 'lb services status'

    or:

    $ vagrant ssh -c 'lb config && make check'

    This works on Windows too, without having to install Putty.

  • To make it easier for others to get started working on your LogicBlox-based project, consider checking in your Vagrantfile into your source control repository.

  • If your project requires additional requirements, like extra packages that need to be installed or extra ports to be mapped, consider adding them to your project's Vagrantfile. The LogicBlox Vagrantfile contains some pointers on how to do this.