SQLite fits the cases where you need SQL queries, transactions, and a durable database file without running a separate database service. You can download and install SQLite on Debian from the default APT sources for the sqlite3 command-line client, or compile the latest upstream release when you need features newer than the versions Debian 13 (trixie), 12 (bookworm), and 11 (bullseye) ship by default.
Most Debian systems do not include SQLite out of the box, but the package is already available in the default repositories. Use the APT path when you want the Debian-managed CLI, and use the source path when you need a newer upstream build and are comfortable handling updates and cleanup yourself.
Install SQLite on Debian
APT is the right fit when you want Debian-managed updates and the least maintenance. Compile from source only when you need a newer upstream SQLite release under /usr/local.
| Method | Channel | Version | Updates | Best For |
|---|---|---|---|---|
| APT Package Manager | Debian Repositories | Debian default package | Automatic through APT | Most users who want the SQLite CLI with normal system updates |
| Source Compilation | SQLite Upstream | Latest upstream release | Manual rebuilds | Development work that needs newer upstream features |
SQLite is already available in Debian’s default APT sources. Debian 13 (trixie) currently offers SQLite 3.46.1-7, Debian 12 (bookworm) offers 3.40.1-2+deb12u2, and Debian 11 (bullseye) offers 3.34.1-3+deb11u1 from bullseye-security.
Update Debian Before Installing SQLite
Refresh the package lists and install any pending updates before you add new software.
sudo apt update && sudo apt upgrade -y
This guide uses
sudofor commands that need root privileges. If your user is not in the sudoers file yet, follow the guide on how to add a user to sudoers on Debian or run the commands asroot.
Install SQLite from Debian’s Default APT Sources
Install the SQLite command-line client on Debian with sudo apt install sqlite3. The sqlite3 package provides the interactive shell and standard CLI tools. If you also need development headers for compiling software against SQLite, install libsqlite3-dev separately.
sudo apt install -y sqlite3
Check the installed SQLite version after APT finishes setting up the package.
sqlite3 --version
3.46.1 2024-08-13 09:16:08 c9c2ab54ba1f5f46360f1b4f35d849cd3f080e6fc2b6c60e91b16c63f69aalt1 (64-bit)
Debian 13 (trixie) uses the output above. Debian 12 (bookworm) returns 3.40.1, and Debian 11 (bullseye) returns 3.34.1 while still receiving Debian security updates for that package branch.
Test SQLite on Debian
A quick shell test confirms that the SQLite CLI can create a database file, write rows, and read them back.
Run a Quick SQLite Shell Test on Debian
Open the SQLite shell with a temporary database file in your home directory.
sqlite3 ~/sqlite-test.db
Enter a few SQL statements inside the shell to create a table, add rows, and print the results.
CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT);
INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com');
INSERT INTO users (name, email) VALUES ('Bob', 'bob@example.com');
.headers on
.mode column
SELECT id, name, email FROM users;
.quit
id name email -- ----- ----------------- 1 Alice alice@example.com 2 Bob bob@example.com
Remove the test database file when you are finished with the shell check.
rm ~/sqlite-test.db
Compile SQLite from Source on Debian
The source method installs the newest upstream SQLite release under /usr/local. It is useful when you need features newer than Debian’s packaged branch, but you take over updates and cleanup yourself.
Install the Build Dependencies for SQLite on Debian
Install the compiler toolchain, readline headers for a usable shell history, zlib headers, and the download tools used later in the build.
sudo apt install -y build-essential libreadline-dev zlib1g-dev curl wget
Download the Latest SQLite Source Tarball on Debian
Create a working directory in your home folder, then pull the current sqlite-autoconf tarball path directly from SQLite’s embedded download metadata.
mkdir -p "$HOME/sqlite-build"
cd "$HOME/sqlite-build"
SQLITE_PATH="$(curl -fsSL https://www.sqlite.org/download.html | awk -F, '$3 ~ /sqlite-autoconf-[0-9]+\.tar\.gz/ {print $3; exit}')"
TARBALL="${SQLITE_PATH##*/}"
curl -fL --progress-bar -o "$TARBALL" "https://www.sqlite.org/$SQLITE_PATH"
######################################################################## 100.0%
Keep using the same terminal session for the next step so the SQLITE_PATH and TARBALL variables still point at the file you just downloaded.
Configure and Build SQLite on Debian
Extract the tarball, configure it for /usr/local, then compile and install the new SQLite build.
cd "$HOME/sqlite-build"
tar -xzf "$TARBALL"
SOURCE_DIR="${TARBALL%.tar.gz}"
cd "$SOURCE_DIR"
./configure --prefix=/usr/local
make -j"$(nproc)"
sudo make install
sudo ldconfig
No installed jimsh or tclsh, building local bootstrap jimsh0 + /usr/bin/install -d /usr/local/lib/pkgconfig + /usr/bin/install -d /usr/local/share/man/man1
The ldconfig step refreshes the shared-library cache so programs can find the new SQLite libraries under /usr/local/lib.
Verify the Source-Built SQLite Version on Debian
Check the upstream build directly first, then confirm which sqlite3 binary your shell finds by default.
/usr/local/bin/sqlite3 --version
command -v sqlite3
3.x.x YYYY-MM-DD HH:MM:SS ... (64-bit) /usr/local/bin/sqlite3
On Debian 13 (trixie), 12 (bookworm), and 11 (bullseye), /usr/local/bin came before /usr/bin, so the source-built SQLite shell replaced the APT one in the default user PATH.
Update a Source-Built SQLite on Debian
A source install does not update through APT, so keep a small rebuild script with the same metadata-based download logic you used for the first install.
Create the SQLite Update Script on Debian
Create the build directory if needed, then save the update script in the same location.
mkdir -p "$HOME/sqlite-build"
cat <<'EOF' > "$HOME/sqlite-build/update-sqlite.sh"
#!/usr/bin/env bash
set -euo pipefail
# Keep source builds in one user-owned working directory.
BUILD_DIR="$HOME/sqlite-build"
INSTALL_PREFIX="/usr/local"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
echo "Checking the latest SQLite release..."
SQLITE_META="$(curl -fsSL https://www.sqlite.org/download.html | awk -F, '$3 ~ /sqlite-autoconf-[0-9]+\.tar\.gz/ {print $2 "|" $3; exit}')"
LATEST_VERSION="${SQLITE_META%%|*}"
SQLITE_PATH="${SQLITE_META#*|}"
CURRENT_VERSION="$($INSTALL_PREFIX/bin/sqlite3 --version 2>/dev/null | awk '{print $1}' || echo none)"
printf 'Current version: %s\n' "$CURRENT_VERSION"
printf 'Latest version: %s\n' "$LATEST_VERSION"
if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ]; then
echo "SQLite is already up to date."
exit 0
fi
TARBALL="${SQLITE_PATH##*/}"
SOURCE_DIR="${TARBALL%.tar.gz}"
echo "Downloading $TARBALL..."
rm -rf "$BUILD_DIR"/sqlite-autoconf-* "$BUILD_DIR"/sqlite-autoconf-*.tar.gz
curl -fL --progress-bar -o "$TARBALL" "https://www.sqlite.org/$SQLITE_PATH"
echo "Extracting and building SQLite..."
tar -xzf "$TARBALL"
cd "$SOURCE_DIR"
./configure --prefix="$INSTALL_PREFIX"
make -j"$(nproc)"
echo "Installing SQLite into $INSTALL_PREFIX..."
sudo make install
sudo ldconfig
NEW_VERSION="$($INSTALL_PREFIX/bin/sqlite3 --version | awk '{print $1}')"
echo "SQLite successfully updated to $NEW_VERSION"
EOF
chmod +x "$HOME/sqlite-build/update-sqlite.sh"
The quoted EOF delimiter tells Bash to write the script exactly as shown, without expanding the script’s variables while you save the file.
Run the SQLite Update Script on Debian
Run the script manually whenever you want to check for a newer upstream SQLite release.
"$HOME/sqlite-build/update-sqlite.sh"
Current version: 3.52.0 Latest version: 3.52.0 SQLite is already up to date.
Run this script manually instead of from cron. Source builds can fail on dependency changes, download problems, or compiler errors, and it is better to see that output in the terminal when it happens.
Remove SQLite from Debian
Use the removal steps that match the way SQLite was installed on your Debian system.
Remove the APT Package on Debian
Remove the Debian package first, then clear any no-longer-needed dependencies.
sudo apt remove -y sqlite3
sudo apt autoremove -y
Refresh the package lists again before you verify that sqlite3 is no longer installed.
sudo apt update
apt-cache policy sqlite3
sqlite3:
Installed: (none)
Candidate: 3.x.x
Version table:
3.x.x 500
500 http://deb.debian.org/debian [release]/main amd64 Packages
The important line is Installed: (none). On Debian 11, the candidate package may appear under bullseye-security instead of bullseye/main, which is normal for that release.
Remove the Source-Built SQLite Files on Debian
These commands remove only the files installed under
/usr/localand your source-build working directory. SQLite database files such as.dbfiles stay where you created them.
Delete the SQLite binary, libraries, headers, metadata files, and the saved build directory.
sudo rm -f /usr/local/bin/sqlite3
sudo rm -f /usr/local/lib/libsqlite3.a /usr/local/lib/libsqlite3.so*
sudo rm -f /usr/local/include/sqlite3.h /usr/local/include/sqlite3ext.h
sudo rm -f /usr/local/lib/pkgconfig/sqlite3.pc /usr/local/share/man/man1/sqlite3.1
sudo ldconfig
rm -rf "$HOME/sqlite-build"
Check which SQLite binary is still available after the source cleanup finishes.
command -v sqlite3 || echo "sqlite3 not found"
sqlite3 not found
If you still have the Debian package installed, this command prints /usr/bin/sqlite3 instead. That means only the source-built copy was removed.
SQLite on Debian FAQ
Use Debian’s sqlite3 package when you want the CLI with normal APT updates and the least maintenance. Compile from source only when you need a newer upstream SQLite release and are comfortable updating and removing the files under /usr/local yourself.
The package you want is sqlite3. If you are compiling software against SQLite as well, add libsqlite3-dev for development headers, but the shell itself comes from the sqlite3 package.
Debian 13 (trixie) currently ships SQLite 3.46.1-7, Debian 12 (bookworm) ships 3.40.1-2+deb12u2, and Debian 11 (bullseye) ships 3.34.1-3+deb11u1 from bullseye-security. Exact package revisions can still move forward when Debian publishes security updates.
That usually means the SQLite shell is not installed, or you removed the source-built copy and no package-managed copy is left. Run sudo apt update and sudo apt install sqlite3, then confirm with command -v sqlite3. If you compiled from source, you can also run /usr/local/bin/sqlite3 directly.
Conclusion
SQLite is installed on Debian and ready for local databases, quick shell tests, and lightweight application development without a separate database service. If your project grows past a single-file database, you can install MariaDB on Debian for a traditional server or install PostgreSQL 15 on Debian when you need heavier SQL features and networked workloads.
Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed in published comments:
<code>command</code>command<strong>bold</strong><em>italic</em><blockquote>quote</blockquote>