Skip to content

Installing under Linux

Open a Bash session (eg LXTerminal) in your home folder and cd to the folder where you downloaded your ZIP file. Unzip the archive. A new folder q will appear there. Copy it to your home folder and cd there.

$ cd ~/Downloads
~/Downloads$ unzip linux-x86.zip
Archive:  linux-x86.zip
  inflating: q/README.txt
  inflating: q/l32/q
  inflating: q/q.q
  inflating: q/q.k
  inflating: q/s.k
  inflating: q/trade.q
  inflating: q/sp.q
~/Downloads$ cp -r q ~/.
~/Downloads$ cd
$

64-bit or 32-bit?

Use the uname command to determine whether your machine is using the 32-bit or 64-bit Linux distribution.

$ uname -m
i686

If the result is i686 or i386 or similar, you are running a 32-bit Linux distribution. If the result is x86_64, you are running a 64-bit Linux distribution.

If you are installing 32-bit kdb+ on a 32-bit Linux distribution, proceed to Launch (minimum install).

But if you are installing 32-bit kdb+ on a 64-bit Linux distribution, you will need a 32-bit library. Use your usual package manager to install i686 or i386: for example:

sudo apt-get install libc6-i386

AskUbuntu: How to run 32-bit app in Ubuntu 64-bit?

Minimum install and launch

Confirm that kdb+ runs. In your home folder, type q/l32/q to see the kdb+ banner and the q) prompt. Type til 6 to see the first six integers. Type \\ to return to Linux.

$ q/l32/q
KDB+ 3.6 2018.07.30 Copyright (C) 1993-2018 Kx Systems
m32/ 2()core 4096MB sjt mark.local 192.168.0.17 NONEXPIRE

Welcome to kdb+ 32bit edition
For support please see http://groups.google.com/d/forum/personal-kdbplus
Tutorials can be found at http://code.kx.com/q/tutorials/install
To exit type \\
To remove this startup msg, edit q.q
q)til 6
0 1 2 3 4 5
q)\\
$

You have completed the minimum installation. We recommend continuing with Complete install and launch.

Complete install and launch

The minimum installation can be improved in two important ways. We strongly recommend them.

  • Call kdb+ within the rlwrap command, which will allow you to call back and edit previous lines
  • Define q as a command alias, allowing you to invoke kdb+ without specifying the path to it

Install Rlwrap

Ask for Rlwrap’s version number. If you see one, Rlwrap is already installed

$ rlwrap -v
rlwrap 0.42
$

If Rlwrap is already installed you can go on to the next step.

Otherwise, you will be told rlwrap: command not found. Install Rlwrap using your package manager.

Edit your profile

In the File Manager, find .bashrc in your home folder.

Bash profile

Open it with a text editor, append the following line

alias q='QHOME=~/q rlwrap -r ~/q/l32/q'

and save it. Start a new Bash session, or tell Bash to use the revised profile:

$ source .bashrc

Installing elsewhere

You can install kdb+ where you please. The environment variables QHOME (specified above) and QLIC tell kdb+ where to find its files.

Confirm successful installation

From your home folder, launch kdb+, type an expression and recall it using the up-arrow key. Exit kdb+.

$ q
KDB+ 3.6 2018.07.30 Copyright (C) 1993-2018 Kx Systems
m32/ 2()core 4096MB sjt mark.local 192.168.0.17 NONEXPIRE

Welcome to kdb+ 32bit edition
For support please see http://groups.google.com/d/forum/personal-kdbplus
Tutorials can be found at http://code.kx.com/q/tutorials/install
To exit type \\
To remove this startup msg, edit q.q
q)til 6 / first 6 integers
0 1 2 3 4 5
q)til 6 / first 6 integers
0 1 2 3 4 5
q)\\
$

Install a license key file

64-bit kdb+ requires a license key file. Obtain and install one.

You’re done. You have completely installed kdb+.

What’s next?

Get started with the q programming language, look through the reference card, or see in the Cookbook what you can do with kdb+.