SQLite

From DreamHost

Jump to: navigation, search

SQLite is a lightweight database that is linked directly into software. The software serves as both the client and server to the database.

Contents

Prerequisites

Requires Environment Setup or Unix account setup to install correctly.

Choose an installation destination

If you use the Unix account setup you have already a ${RUN} environment variable set up (in .bashrc) and you install everything there.

If you install packages directly in your home directory (${HOME}), then type:

export RUN=${HOME}

If you install packages in other directory of your choice (e.g. packages directly under your home directory -${HOME}), then type:

export RUN=${HOME}/packages

(replace packages above by the directory name you want).

Note where you installed it, since you'll probably need to know this when you want to configure other packages to use SQLite.

SQLite Version

Assign to an environment variable the version you want to install:

  • Version 2 (historic)
VERSION=2.8.17
  • Version 3 (current)
VERSION=3.5.6

You can install both versions. The command sqlite will be used for version 2 and sqlite3 for version 3.

Download SQLite

As recommended in the README, create a separate build directory.

mkdir -pv ${HOME}/soft
wget http://www.sqlite.org/sqlite-${VERSION}.tar.gz
tar zxf sqlite-${VERSION}.tar.gz
mkdir -pv sqlite-build-${VERSION}
cd sqlite-build-${VERSION}

Set lib directory

Tell the installer where the lib directory will be placed, otherwise you will end up with a new executable that links to an old lib location:

LD_RUN_PATH=${HOME}/packages/lib

(change if you have a different install location than packages)

Configure

../sqlite-${VERSION}/configure --prefix=${RUN}

Troubleshooting: Locking Database Errors

If you get database locking errors than you need to use the --enable-threadsafe option when configuring.

../sqlite-${VERSION}/configure --prefix=${RUN} --enable-threadsafe

Installation

make
make install

Create Link

(DON'T do this if you are installing both version 2 and version 3)

If sqlite3 exists but sqlite doesn't then create a link for it in the $RUN/bin folder.

Go to the directory that you installed sqlite to.

cd ${RUN}/bin

Then create a symbolic link.

ln -s sqlite3 sqlite
Personal tools