Install and configure SQLite on your server

By Gary Sieling

Gary Sieling
Sep 14, 2017 · 3 min read
Image for post
Image for post

SQLite is the most deployed relational database because it is designed to be embedded within software applications, rather than accessed as a server database. It is available within most browsers through the Web SQL API and is commonly used in mobile applications.

Because SQLite is used in embedded systems, it is designed to be predictable and robust. While many SQLite instances may be small, it boasts the ability to handle fairly large datasets and high read volumes (e.g., websites with 100,000 page loads per day).

Installation and Testing

If you would like to learn how SQLite works, you can easily deploy it on a Linode server:

When you install you’ll notice that this is only about 50k to install — SQLite is designed to be very light-weight due to it’s use in embedded systems.

Once this installs, you can test it by running some commands. If you invoke the sqlite command line with a filename, it will store the data you insert in the requested file:

All of the sqlite commands start with a period — you can view them all with “.help”.

Compiling from Source

You can also compile directly from source by downloading the sqlite source and unzipping it:

If you want to use SQLite within an application, you can use the ‘amalgamation’ source code download. The amalgamation mode is a set of three files, containing the entire SQLite codebase. These are intended for situations where you wish to build SQLite into an existing product, and make it easy to drag and drop the files into your project.

If you’re really kicking the tires on SQLite, you should explore the various compiler options — there is a long list, allowing you to limit the size of the compiler output and disable unused features to improve performance. For instance, you can disable thread safety, power loss safety, and the progress indicator for SQL. You can also enable or disable SQL features like full text search, autovacuum, and even specific language or execution plan features.

Backup / Restore script

If you would like to make a backup of the database, you can do .dump, which produces the a backup for the database:

By putting this into a bash script, you can create a file:

Then run it with sqlite:

You can restore this like so:

Alternative Uses

Because SQLite is so popular and well-supported, there are a few interesting alternative distributions:

SQLite has been compiled to a pure JavaScript solution using Emscripten, called SQL.js.

There is a REST Web API for SQLite called ArrestDB, which allows you to create tables and modify data through HTTP.

It is also available for app development within Android and iOS.


SQLite offers two commands to perform maintenance, ANALYZE and VACUUM. While most databases will change the algorithms used to compute queries as time progresses, SQLite guarantees stable execution plans, so that it behaves the same in the future as it does today. If you use SQLite in an application, you should make sure these commands are being used according to the guidance in the manual.

SQLite has a reputation for reliability and consistency. It is a fantastic light-weight database, used in mobile phones, applications, and industrial embedded systems. While many well-known databases have processes that clean and introspect to maintain performance over time, SQLite offers a simple file-based database, allowing you, the developer, full control to use just the database features you want.

Gary Sieling is a Software Architect in Philadelphia, PA. He runs a search engine for conference talks and historic speeches, called You can find him on Twitter at Gary Sieling.

We’re covering everything from tech news and industry…

Gary Sieling

Written by

Linode Cube
Gary Sieling

Written by

Software architect; Philadelphia, PA and

Linode Cube

We’re covering everything from tech news and industry happenings to event recaps and general tips.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store