1. 程式人生 > >怎樣在Linux下從原始碼安裝SQLite3

怎樣在Linux下從原始碼安裝SQLite3

SQLite3是一個極輕型的獨立的無伺服器的SQL資料庫引擎。

你不需要做任何的配置來使其工作。所有你需要的就是安裝它並開始使用它。

既然是無伺服器的,它被用在很多你所使用的著名的軟體中,甚至你可能並不知道那些軟體正在使用它。看看下面的例子所有的大公司正在使用SQLiete.PUP程式語言內嵌了SQLite資料庫於其中。

如果你從來沒有使用過SQLite,按照下面的文章中所提到的步驟安裝在Linux上,並且建立了一個例子資料庫。

下載SQLite3原始碼

去SQLite下載頁面,並點選“sqlite-autoconf-3070603.tar.gz”(在原始碼部分),並下載到你的系統中。或者使用wget直接從伺服器下載就像下面。

安裝 SQLite3

Uncompress the tar.gz file and install SQLite3 as shown below.

解壓tar.gz檔案並像下面所示安裝

tar xvfz sqlite-autoconf-3070603.tar.gz
cd sqlite-autoconf-3070603
./configure
make
make install

make安裝命令後會有以下的輸出。

test -z "/usr/local/bin" || mkdir -p -- "/usr/local/bin"
  ./libtool --mode=install /usr/bin/install -c sqlite3 /usr/local/bin/sqlite3
/usr/bin/install -c .libs/sqlite3 /usr/local/bin/sqlite3
test -z "/usr/local/include" || mkdir -p -- "/usr/local/include"
 /usr/bin/install -c -m 644 'sqlite3.h' '/usr/local/include/sqlite3.h'
 /usr/bin/install -c -m 644 'sqlite3ext.h' '/usr/local/include/sqlite3ext.h'
test -z "/usr/local/share/man/man1" || mkdir -p -- "/usr/local/share/man/man1"
 /usr/bin/install -c -m 644 './sqlite3.1' '/usr/local/share/man/man1/sqlite3.1'
test -z "/usr/local/lib/pkgconfig" || mkdir -p -- "/usr/local/lib/pkgconfig"
 /usr/bin/install -c -m 644 'sqlite3.pc' '/usr/local/lib/pkgconfig/sqlite3.pc'

提示:如果你對mysql資料庫有興趣,你也可以安裝在你的系統中。

原文:

SQLite3 is an extremely lightweight SQL database engine that is self-contained and serverless.

There is absolutely no configuration that you need to do to get it working. All you need to do is–install it, and start using it.

Since this is serverless, it is used in lot of the famous software that you are using, and you probably didn’t even know those software were using it. View

this list to see all the big name companies who are using SQLite. PHP programming language has SQLite database built in.

If you’ve never used SQLite, follow the steps mentioned in this article to install it on Linux, and create a sample database.

Download SQLite3 Source

Go to the SQLite Download page, and click on “sqlite-autoconf-3070603.tar.gz” (Under Source Code section), and download it to your system. Or, use the wget to directly download it to your server as shown below.

wget http://www.sqlite.org/sqlite-autoconf-3070603.tar.gz

Install SQLite3 from Source

Uncompress the tar.gz file and install SQLite3 as shown below.

tar xvfz sqlite-autoconf-3070603.tar.gz
cd sqlite-autoconf-3070603
./configure
make
make install

make install command will displays the following output indicating that it is installing sqlite3 binaries under /usr/local/bin

test -z "/usr/local/bin" || mkdir -p -- "/usr/local/bin"
  ./libtool --mode=install /usr/bin/install -c sqlite3 /usr/local/bin/sqlite3
/usr/bin/install -c .libs/sqlite3 /usr/local/bin/sqlite3
test -z "/usr/local/include" || mkdir -p -- "/usr/local/include"
 /usr/bin/install -c -m 644 'sqlite3.h' '/usr/local/include/sqlite3.h'
 /usr/bin/install -c -m 644 'sqlite3ext.h' '/usr/local/include/sqlite3ext.h'
test -z "/usr/local/share/man/man1" || mkdir -p -- "/usr/local/share/man/man1"
 /usr/bin/install -c -m 644 './sqlite3.1' '/usr/local/share/man/man1/sqlite3.1'
test -z "/usr/local/lib/pkgconfig" || mkdir -p -- "/usr/local/lib/pkgconfig"
 /usr/bin/install -c -m 644 'sqlite3.pc' '/usr/local/lib/pkgconfig/sqlite3.pc'

Note: If you are interested in installing MySQL database on your system, you can either use yum groupinstall mysql, or install mysql from rpm.