How to Install SQLite on Debian 13, 12 and 11

Last updated Friday, May 22, 2026 9:35 am Joshua James 6 min read

SQLite fits the cases where you need SQL queries, transactions, and a durable database file without running a separate database service. To install SQLite on Debian, use 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.

MethodChannelVersionUpdatesBest For
APT Package ManagerDebian RepositoriesDebian default packageAutomatic through APTMost users who want the SQLite CLI with normal system updates
Source CompilationSQLite UpstreamLatest upstream releaseManual rebuildsDevelopment work that needs newer upstream features

SQLite is already available in Debian’s default APT sources. Current APT metadata shows SQLite 3.46.1-7+deb13u1 on Debian 13 (trixie), 3.40.1-2+deb12u2 on Debian 12 (bookworm), and 3.34.1-3+deb11u1 from bullseye-security on Debian 11 (bullseye). Run apt-cache policy sqlite3 libsqlite3-dev if you need to confirm the exact revision from your enabled repositories.

Update Debian Before Installing SQLite

Refresh the package lists before you install SQLite so APT uses current repository metadata.

sudo apt update

These commands use sudo for tasks 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 as root.

Install SQLite from Debian’s Default APT Sources

Install the SQLite command-line client on Debian with sudo apt install sqlite3. The package name is sqlite3, and it provides the interactive shell plus standard CLI tools.

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)

The Debian 13 (trixie) package returns a 3.46.1 runtime version. 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.

Install SQLite Development Headers on Debian

Install libsqlite3-dev only when you compile software that links against SQLite. The SQLite shell itself does not require this development package.

sudo apt install -y libsqlite3-dev

Confirm the installed development package revision when a build needs a specific SQLite branch.

dpkg-query -W -f='${Version}\n' libsqlite3-dev
3.46.1-7+deb13u1

Debian 13 (trixie) returns this package revision. Debian 12 (bookworm) and Debian 11 (bullseye) return their matching libsqlite3-dev revisions from the same APT sources as the sqlite3 package.

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, HTTPS certificates, OpenSSL for the SHA3 check, and the download tool used later in the build.

sudo apt install -y build-essential libreadline-dev zlib1g-dev curl ca-certificates openssl

Download the Latest SQLite Source Tarball on Debian

Create a working directory in your home folder, then pull the current sqlite-autoconf tarball path and SHA3 hash directly from SQLite’s embedded download metadata. For more detail on the transfer options, see these curl command examples.

if mkdir -p "$HOME/sqlite-build" && cd "$HOME/sqlite-build"; then
  if ! SQLITE_META="$(curl -fsSL https://www.sqlite.org/download.html | awk -F, '$1=="PRODUCT" && $3 ~ /sqlite-autoconf-[0-9]+\.tar\.gz$/ && !seen {print $2 "|" $3 "|" $5; seen=1} END {if (!seen) exit 1}')"; then
    printf 'Could not find the sqlite-autoconf tarball in SQLite download metadata.\n' >&2
    rm -f sqlite-build.env
  else
    REST="${SQLITE_META#*|}"
    SQLITE_PATH="${REST%%|*}"
    EXPECTED_SHA3="${REST#*|}"
    TARBALL="${SQLITE_PATH##*/}"
    if curl -fL --progress-bar -o "$TARBALL" "https://www.sqlite.org/$SQLITE_PATH"; then
      ACTUAL_SHA3="$(openssl dgst -sha3-256 -r "$TARBALL" | awk '{print $1}')"
      if [ "$ACTUAL_SHA3" = "$EXPECTED_SHA3" ]; then
        printf 'SHA3 check passed for %s\n' "$TARBALL"
        printf 'TARBALL=%s\n' "$TARBALL" >sqlite-build.env
      else
        printf 'SHA3 check failed for %s\n' "$TARBALL" >&2
        printf 'Expected: %s\nActual:   %s\n' "$EXPECTED_SHA3" "$ACTUAL_SHA3" >&2
        rm -f "$TARBALL" sqlite-build.env
      fi
    else
      printf 'Could not download %s\n' "$TARBALL" >&2
      rm -f "$TARBALL" sqlite-build.env
    fi
  fi
else
  printf 'Could not enter the SQLite build directory.\n' >&2
fi

Continue only after the SHA3 check passes and sqlite-build.env exists in the build directory. The build step reads that file so it compiles the exact tarball you verified.

Configure and Build SQLite on Debian

Extract the tarball, configure it for /usr/local, then compile and install the new SQLite build.

if cd "$HOME/sqlite-build"; then
  if [ ! -s sqlite-build.env ]; then
    printf 'Missing sqlite-build.env; rerun the download step.\n' >&2
  else
    TARBALL="$(sed -n 's/^TARBALL=//p' sqlite-build.env)"
    if [ -z "$TARBALL" ]; then
      printf 'sqlite-build.env does not contain a tarball name.\n' >&2
    else
      SOURCE_DIR="${TARBALL%.tar.gz}"
      rm -rf "$SOURCE_DIR"
      tar -xzf "$TARBALL" &&
        cd "$SOURCE_DIR" &&
        ./configure --prefix=/usr/local &&
        make -j"$(nproc)" &&
        sudo make install &&
        sudo ldconfig &&
        hash -r
    fi
  fi
else
  printf 'Could not enter the SQLite build directory.\n' >&2
fi
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. The hash -r command clears any cached /usr/bin/sqlite3 path in the current Bash session before you verify the source-built command.

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.53.1 2026-05-05 10:34:17 c88b22011a54b4f6fbd149e9f8e4de77658ce58143a1af0e3785e4e6475127e9 (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 command with the same metadata-based download logic you used for the first install.

Create the SQLite Update Command on Debian

Create a user-local command named update-sqlite. The build files stay in $HOME/sqlite-build, while the command itself lives in $HOME/.local/bin so you can run it by name.

mkdir -p "$HOME/.local/bin"
cat <<'EOF' >"$HOME/.local/bin/update-sqlite"
#!/usr/bin/env bash
set -euo pipefail

BUILD_DIR="$HOME/sqlite-build"
INSTALL_PREFIX="/usr/local"

for required_command in awk curl make nproc openssl sudo tar; do
  if ! command -v "$required_command" >/dev/null 2>&1; then
    printf 'Missing required command: %s\n' "$required_command" >&2
    exit 1
  fi
done

mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"

printf 'Checking the latest SQLite release...\n'
if ! SQLITE_META="$(curl -fsSL https://www.sqlite.org/download.html | awk -F, '$1=="PRODUCT" && $3 ~ /sqlite-autoconf-[0-9]+\.tar\.gz$/ && !seen {print $2 "|" $3 "|" $5; seen=1} END {if (!seen) exit 1}')"; then
  printf 'Could not find the sqlite-autoconf tarball in SQLite download metadata.\n' >&2
  exit 1
fi
LATEST_VERSION="${SQLITE_META%%|*}"
REST="${SQLITE_META#*|}"
SQLITE_PATH="${REST%%|*}"
EXPECTED_SHA3="${REST#*|}"
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
  printf 'SQLite is already up to date.\n'
  exit 0
fi

TARBALL="${SQLITE_PATH##*/}"
SOURCE_DIR="${TARBALL%.tar.gz}"

printf 'Downloading %s...\n' "$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"
ACTUAL_SHA3="$(openssl dgst -sha3-256 -r "$TARBALL" | awk '{print $1}')"
if [ "$ACTUAL_SHA3" != "$EXPECTED_SHA3" ]; then
  printf 'SHA3 check failed for %s\n' "$TARBALL" >&2
  printf 'Expected: %s\nActual:   %s\n' "$EXPECTED_SHA3" "$ACTUAL_SHA3" >&2
  exit 1
fi

printf 'Extracting and building SQLite...\n'
tar -xzf "$TARBALL"
cd "$SOURCE_DIR"
./configure --prefix="$INSTALL_PREFIX"
make -j"$(nproc)"

printf 'Installing SQLite into %s...\n' "$INSTALL_PREFIX"
sudo make install
sudo ldconfig

NEW_VERSION="$($INSTALL_PREFIX/bin/sqlite3 --version | awk '{print $1}')"
printf 'SQLite successfully updated to %s\n' "$NEW_VERSION"
EOF
chmod +x "$HOME/.local/bin/update-sqlite"
export PATH="$HOME/.local/bin:$PATH"
command -v update-sqlite
/home/joshua/.local/bin/update-sqlite

The quoted EOF delimiter tells Bash to write the script exactly as written, without expanding the script’s variables while you save the file. A successful setup prints a path ending in /.local/bin/update-sqlite; the username segment depends on your account.

Run the SQLite Update Command on Debian

Run the command manually whenever you want to check for a newer upstream SQLite release.

update-sqlite
Current version: 3.53.1
Latest version:  3.53.1
SQLite is already up to date.

Run this command 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.

Troubleshoot SQLite on Debian

Most SQLite install problems on Debian come from the command-line package not being installed or from a shell session caching an older command path.

Fix sqlite3: command not found on Debian

Check whether your shell can find the SQLite command first.

command -v sqlite3 || echo "sqlite3 not found"

If the command is missing and you want the Debian package, install sqlite3 and clear Bash’s command cache before checking again.

sudo apt update
sudo apt install -y sqlite3
hash -r
command -v sqlite3

If you compiled SQLite from source and the APT package is not installed, check the source-built command directly with /usr/local/bin/sqlite3 --version. A successful source build should also appear as /usr/local/bin/sqlite3 after you run hash -r in the current shell.

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 when you no longer need the command-line shell from APT. This does not remove existing SQLite database files or the shared libsqlite3-0 library used by other Debian packages.

sudo apt remove -y sqlite3

If you installed development headers for compiling software against SQLite, remove that optional package separately.

sudo apt remove -y libsqlite3-dev

Verify that the CLI package is no longer installed with a package-status check.

dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' sqlite3 2>/dev/null || echo "sqlite3 package is not installed"
sqlite3 package is not installed

Remove the Source-Built SQLite Files on Debian

These commands remove only the files installed under /usr/local, the user-local update-sqlite command, and your source-build working directory. SQLite database files such as .db files stay where you created them.

Delete the SQLite binary, libraries, headers, metadata files, update command, and saved build directory.

cd "$HOME" || exit
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 -f "$HOME/.local/bin/update-sqlite"
rm -rf "$HOME/sqlite-build"
hash -r

Check that the updater command is gone, then check which SQLite binary is still available after the source cleanup finishes.

command -v update-sqlite || echo "update-sqlite not found"
command -v sqlite3 || echo "sqlite3 not found"
update-sqlite 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.

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.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: