This appendix will show you where to go online to download the latest version of SQLite, how to pick the correct distribution, and—if you decide on a source code installation—how to compile it.
The download page for SQLite is http://www.sqlite.org/download.html and is split into three sections:
Precompiled Binaries for Linux
Precompiled Binaries for Windows
Source Code
Unless you have a particular requirement to build SQLite from source, a binary distribution will work fine for Linux and Windows systems.
Version numbers shown in this appendix are current at the time of writing; however, you should check for the latest stable version.
The easiest way to install SQLite on compatible Linux systems is to use the RPM packages. The rpm
command is found on the RedHat and Fedora Core Linux distributions, though other distributions may also support it.
There are two RPM packages available for SQLite, found in the precompiled binaries section of the download page.
sqlite-2.8.15-1.i386.rpm
contains the shared library required to run dynamically linked SQLite applications, and the sqlite
program.
sqlite-devel-2.8.15-1.i386.rpm
contains the static library, header files, and documentation in the form of man
pages.
You should obtain both packages and install using the following steps as the root user:
# rpm -ivh sqlite-2.8.15-1.i386.rpm Preparing... ########################################### [100%] 1:sqlite ########################################### [100%] # rpm -ivh sqlite-devel-2.8.15-1.i386.rpm Preparing... ########################################### [100%] 1:sqlite-devel ########################################### [100%]
The sqlite
package must be installed before sqlite-devel
to satisfy the package dependencies.
The non-RPM binary distribution of SQLite is split into three files.
sqlite-2.8.15.bin.gz
is a statically linked version of the sqlite program. This can be used alone to access and create SQLite databases from the command line.
sqlite-2.8.15.so.gz
is the shared library that is needed to compile programs using the C/C++ interface.
tclsqlite-2.8.15.so.gz
is a library file containing the TCL bindings for SQLite as well as the C/C++ interface.
Installation of each package is done using the same basic steps—uncompress the file, move it to a suitable location on your system, and set the appropriate file permission.
The sqlite
program should reside in a location that is in your path, such as /usr/bin
or /usr/local/bin
and should be executable by all users. Run the following commands as the root user:
# gunzip sqlite-2.8.15.bin.gz # mv sqlite-2.8.15.bin /usr/local/bin/sqlite # chmod 755 /usr/local/bin/sqlite
The libsqlite.so
library should reside in a location where it will be found by the C compiler, such as /usr/lib
or /usr/local/lib
, and should also be world-readable with the execute bit set.
# gunzip sqlite-2.8.15.so.gz # mv sqlite-2.8.15.so /usr/local/lib/libsqlite.so # chmod 755 /usr/local/lib/libsqlite.so
On most systems, the file /etc/ld.so.conf
contains a list of locations in which the linker will attempt to find a library file. In some cases it may be necessary to run the following command to ensure that libsqlite.so
can be found:
# /sbin/ldconfig
The TCL-enabled library should be copied to a location that tclsh
can import it from, such as a subdirectory of /usr/lib/tcl
or /usr/share/tcl
.
The binary distribution for Windows consists of three Zip files.
sqlite-2_8_15.zip
contains the sqlite.exe
monitor program and library sqlite.dll
.
sqlitedll-2_8_15.zip
contains only the same sqlite.dll
that is shipped with sqlite.exe
. You do not need this package if you are also installing sqlite-2_8_15.zip
.
tclsqlite-2_8_15.zip
contains tclsqlite.dll
, the library file with TCL bindings included.
Installation of each of these is a case of extracting the contents of the Zip file using WinZip or a similar program and moving the individual components to an appropriate location on your system.
You should either put sqlite.exe
in a folder that is in your command path or add its location to the path variable. The following command adds C:sqlite
to the command path:
C:>path %PATH%;C:sqlite
The library files should be placed in the usual place for DLLs on your system, for example C:WINDOWSSYSTEM32
.
To install SQLite on a platform for which there is no binary distribution, your only option is to build from source. Two different source code archives are provided in .zip
and .tar.gz
format.
The following steps deal with extracting and compiling SQLite from the .tar.gz
format on a Unix system. Obtain the file sqlite-2.8.15.tar.gz
and extract with the following command:
# gunzip -c sqlite-2.8.15.tar.gz | tar xf –
A directory called sqlite
will be created. Go into this directory and run the configure
command.
# cd sqlite # ./configure checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes [...] configure: creating ./config.status config.status: creating Makefile config.status: creating sqlite.pc
The output from configure
is many screens of text while the program works out your system settings. When it has finished, you can commence compilation by issuing the make
command, and if everything appears to be in order, install SQLite with make install
.
# make # make install
SQLite will then be installed to the appropriate places on your system.
3.145.64.126