<?xml version="1.0" encoding="UTF-8"?>
<page>
  <content>These are instructions are for building "SQLite":http://www.sqlite.org/ from source.  SQLite is a fantastic little database, and favorite of mine when building Rails apps that center around things like content management and blogging.  I'll do a longer post in the future on why and when to choose SQLite over bigger more traditional databases like MySQL, Postgres, SQL Server, and Oracle.

Sorry Windows users, these instructions are for OS X and Linux/Unix people, but fear not, the SQLite homepage has "prebuilt binaries":http://www.sqlite.org/download.html for you.

A quick note:  These instructions are in the same vein as Dan Benjamin's "how to build from source" instructions on "Hivelogic":http://www.hivelogic.com/ and he has plenty written on why to use "/usr/local":http://hivelogic.com/articles/2005/11/29/using_usr_local and how to get the "prerequisites":http://hivelogic.com/articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger set up on your machine.  If you don't have /usr/local in your path, and don't have the build tools set up yet, go take a look at those two articles and come back when you're done.  It's not scary, I promise.

Back? Great, continuing...

h2. Getting the SQLite Source

First you need to get the source for SQLite. Make sure you're in your temp directory first for downloading the source code.

&lt;pre&gt;
curl -O http://www.sqlite.org/sqlite-3.3.5.tar.gz
tar xvzf sqlite-3.3.5.tar.gz
cd sqlite-3.3.5
&lt;/pre&gt;

h2. Building SQLite

Next is the build process, which is just as easy.

&lt;pre&gt;
./configure --prefix=/usr/local
make
sudo make install
cd .. 
&lt;/pre&gt;

h2. Final Steps

Well, really, there aren't any final steps, you should have a functional install of SQLite working now, but to test it type:

&lt;pre&gt;
sqlite3 -version
&lt;/pre&gt;

...and you should see the output:

&lt;pre&gt;
3.3.5
&lt;/pre&gt;

You also might want to clean up your temp build directory by running:

&lt;pre&gt;
rm -rvf sqlite-3.3.5
rm -f sqlite-3.3.5.tar.gz
&lt;/pre&gt;

If all has gone according to plan you now have a working install of SQLite, and are free to enjoy the pleasures of a small, fast, file based, zero config database.</content>
  <created-on type="datetime">2006-05-02T15:09:17+00:00</created-on>
  <has-changes type="integer">0</has-changes>
  <html>&lt;p&gt;These are instructions are for building &lt;a href="http://www.sqlite.org/"&gt;SQLite&lt;/a&gt; from source.  SQLite is a fantastic little database, and favorite of mine when building Rails apps that center around things like content management and blogging.  I&amp;#8217;ll do a longer post in the future on why and when to choose SQLite over bigger more traditional databases like MySQL, Postgres, &lt;span class="caps"&gt;SQL &lt;/span&gt;Server, and Oracle.&lt;/p&gt;


	&lt;p&gt;Sorry Windows users, these instructions are for &lt;span class="caps"&gt;OS X&lt;/span&gt; and Linux/Unix people, but fear not, the SQLite homepage has &lt;a href="http://www.sqlite.org/download.html"&gt;prebuilt binaries&lt;/a&gt; for you.&lt;/p&gt;


	&lt;p&gt;A quick note:  These instructions are in the same vein as Dan Benjamin&amp;#8217;s &amp;#8220;how to build from source&amp;#8221; instructions on &lt;a href="http://www.hivelogic.com/"&gt;Hivelogic&lt;/a&gt; and he has plenty written on why to use &lt;a href="http://hivelogic.com/articles/2005/11/29/using_usr_local"&gt;/usr/local&lt;/a&gt; and how to get the &lt;a href="http://hivelogic.com/articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger"&gt;prerequisites&lt;/a&gt; set up on your machine.  If you don&amp;#8217;t have /usr/local in your path, and don&amp;#8217;t have the build tools set up yet, go take a look at those two articles and come back when you&amp;#8217;re done.  It&amp;#8217;s not scary, I promise.&lt;/p&gt;


	&lt;p&gt;Back? Great, continuing&amp;#8230;&lt;/p&gt;


	&lt;h2&gt;Getting the SQLite Source&lt;/h2&gt;


	&lt;p&gt;First you need to get the source for SQLite. Make sure you&amp;#8217;re in your temp directory first for downloading the source code.&lt;/p&gt;


&lt;pre&gt;
curl -O http://www.sqlite.org/sqlite-3.3.5.tar.gz
tar xvzf sqlite-3.3.5.tar.gz
cd sqlite-3.3.5
&lt;/pre&gt;

	&lt;h2&gt;Building SQLite&lt;/h2&gt;


	&lt;p&gt;Next is the build process, which is just as easy.&lt;/p&gt;


&lt;pre&gt;
./configure --prefix=/usr/local
make
sudo make install
cd .. 
&lt;/pre&gt;

	&lt;h2&gt;Final Steps&lt;/h2&gt;


	&lt;p&gt;Well, really, there aren&amp;#8217;t any final steps, you should have a functional install of SQLite working now, but to test it type:&lt;/p&gt;


&lt;pre&gt;
sqlite3 -version
&lt;/pre&gt;

	&lt;p&gt;...and you should see the output:&lt;/p&gt;


&lt;pre&gt;
3.3.5
&lt;/pre&gt;

	&lt;p&gt;You also might want to clean up your temp build directory by running:&lt;/p&gt;


&lt;pre&gt;
rm -rvf sqlite-3.3.5
rm -f sqlite-3.3.5.tar.gz
&lt;/pre&gt;

	&lt;p&gt;If all has gone according to plan you now have a working install of SQLite, and are free to enjoy the pleasures of a small, fast, file based, zero config database.&lt;/p&gt;</html>
  <id type="integer">12</id>
  <is-post type="integer">1</is-post>
  <is-published type="integer">1</is-published>
  <title>Building SQLite</title>
  <url>notebook/2006/05/02/building_sqlite</url>
</page>
