Tutorials/Installation

From Kx Wiki
Jump to: navigation, search

301 Permanent move

The wiki is moving to a new format and this page is no longer maintained. You can find the new page at code.kx.com/q/tutorials/install/.

This page will remain here until the migration is complete. If you prefer the wiki to the new format, please tell the Librarian why.


Installation instructions for the free 32-bit version of kdb+.


Contents

Mac OS X

kdb+ can be downloaded from kx.com. Follow the download instructions.

If necessary, unzip the archive. A new folder q will appear in your Downloads folder.

Next perform the Minimum install and launch. We strongly recommend continuing then to the Complete install and launch.


Minimum install and launch

Open the Terminal application (Bash). It will prompt you with its own version of the following:

Mark:~ sjt$ 

Answer the prompts as follows:

caption Answer the prompts like this.

You have installed and launched kdb+.

To exit from kdb+, type \\


Complete install and launch

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


Install Rlwrap

Exit kdb to return to the Bash prompt and your home folder. Ask for Rlwrap’s version number. if you see one, Rlwrap is already installed

caption rlwrap -v

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. (Probably either MacPorts or Homebrew)


Edit your profile

In Bash, open your profile ~/.bash_profile with TextEdit (or your favourite text editor)

caption open -a Textedit .bash_profile

and append the following line

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

and save it. Tell Bash to use the revised profile:

caption source .bash_profile

Confirm installation

From your home folder open q, type an expression and recall it using the up-arrow key:

caption In q, type an expression and recall it with the up-arrow key

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


What’s next?

Try our other tutorials, have a look at the reference page, or see what you can do with q/kdb+ in the Cookbook section.


Microsoft Windows

kdb+ can be downloaded from kx.com. Follow the download instructions.

This will put a file windows.zip in your Downloads folder. Extract the files to C:\, producing a new folder C:\q. (You can install on a different filepath. If you do, in the following instructions simply replace C:\q with your filepath.)


Confirm q is working

Open a MS_DOS shell window: type Windows-r (or click the Start button) and type cmd.

Launch q by typing C:\q\w32\q. You should see the kdb+ banner. Type til 6 to see the first 6 integers. Type \\ to exit q.

caption C:32


Define q as a command

Defining q as a command allows you to invoke kdb+ without specifying the path to it.

In the MS-DOS shell, type

setx QHOME "C:\q"
setx PATH "%PATH%;C:\q\w32"
exit
caption Setting environment variables

This will close your shell session. Open a new shell session and confirm q now works as a command.

caption Confirm q works as a command

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


What’s next?

Try our other tutorials, have a look at the reference page, or see what you can do with q/kdb+ in the Cookbook section.


Linux

kdb+ can be downloaded from kx.com. Follow the download instructions.

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

caption cd ~/Downloads unzip linux-x86.zip cp -r q ~/. cd ~


32-bit or 64-bit?

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

uname -m
caption Determining the distribution bit size

If the result is i686 or i386 or similar, you are running a 32-bit distribution. If the results is x86_64, you are running a 64-bit 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


Launch (minimum install)

Confirm that kdb runs. In your home folder, type:

q/l32/q
caption Launching q

to see the kdb banner. At the q) prompt, type til 6 to see the first six integers. Type \\ to return to Linux.

You have completed the minimum installation. We recommend proceeding to the Complete installation.


Complete install and launch

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


Install Rlwrap

Exit kdb to return to the Bash prompt and your home folder. Ask for Rlwrap’s version number. if you see one, Rlwrap is already installed

caption Exit q and see if Rlwrap is installed

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 and append the following line

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

and save it. Tell Bash to use the revised profile: source .bashrc

source .bashrc

Confirm installation

From your home folder open q, type an expression and recall it using the up-arrow key:

caption In q, type an expression and recall it with the up-arrow key

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


What’s next?

Try our other tutorials, have a look at the reference page, or see what you can do with q/kdb+ in the Cookbook section.

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox