SQLite 的一個重要的特性是零配置的,這意味著不需要復雜的安裝或管理。本章將講解 Windows、Linux 和 Mac OS X 上的安裝設置。
請訪問 SQLite 下載頁面,從 Windows 區(qū)下載預編譯的二進制文件。
您需要下載 sqlite-shell-win32-.zip 和 sqlite-dll-win32-.zip 壓縮文件。
創(chuàng)建文件夾 C:>sqlite,并在此文件夾下解壓上面兩個壓縮文件,將得到 sqlite3.def、sqlite3.dll 和 sqlite3.exe 文件。
C:\>sqlite3
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
目前,幾乎所有版本的 Linux 操作系統(tǒng)都附帶 SQLite。所以,只要使用下面的命令來檢查您的機器上是否已經(jīng)安裝了 SQLite。
$sqlite3
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
如果沒有看到上面的結果,那么就意味著沒有在 Linux 機器上安裝 SQLite。因此,讓我們按照下面的步驟安裝 SQLite:
請訪問 SQLite 下載頁面,從源代碼區(qū)下載 *sqlite-autoconf-.tar.gz**。
$tar xvfz sqlite-autoconf-3071502.tar.gz
$cd sqlite-autoconf-3071502
$./configure --prefix=/usr/local
$make
$make install
上述步驟將在 Linux 機器上安裝 SQLite,您可以按照上述講解的進行驗證。
最新版本的 Mac OS X 會預安裝 SQLite,但是如果沒有可用的安裝,只需按照如下步驟進行:
請訪問 SQLite 下載頁面,從源代碼區(qū)下載 *sqlite-autoconf-.tar.gz**。
$tar xvfz sqlite-autoconf-3071502.tar.gz
$cd sqlite-autoconf-3071502
$./configure --prefix=/usr/local
$make
$make install
上述步驟將在 Mac OS X 機器上安裝 SQLite,您可以使用下列命令進行驗證:
$sqlite3
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
最后,在 SQLite 命令提示符下,使用 SQLite 命令做練習。