Menu

Install SQLite on Red Hat Enterprise Linux 8

Install the SQLite command-line shell on RHEL 8 with DNF, verify sqlite3, and run a quick in-memory SQL check.

Posted on By
On this page

On Red Hat Enterprise Linux 8, install SQLite from the configured repositories with dnf. This guide installs the sqlite package and verifies the sqlite3 command-line shell. SQLite is an embedded database library, not a database server that needs a service started.

Prerequisites

  • A working Red Hat Enterprise Linux 8 system with access to its enabled software repositories.
  • A user account that can run commands with sudo.

RHEL 8 uses YUM based on DNF; dnf is available as the package manager. See the Red Hat software management guide.

Install SQLite

Install the sqlite package:

sudo dnf install sqlite

Review the package transaction and confirm when prompted. You do not need to upgrade the whole operating system just to install SQLite.

Verify the installation

Check the installed command-line version:

sqlite3 --version

Then run a query against a temporary in-memory database:

sqlite3 :memory: "SELECT sqlite_version();"

The query prints the SQLite library version available to the command-line shell. The exact version depends on the enabled RHEL 8 repositories and updates.

Open a database file

Pass a filename to open a persistent database. If the file does not exist, the SQLite command-line shell creates it:

sqlite3 sample.db

Without a filename, sqlite3 uses a temporary in-memory database that is deleted when the shell exits. See the SQLite command-line shell guide for more commands.

If DNF cannot find the package, check which repositories are enabled and whether the system can access its RHEL software sources:

sudo dnf repolist
sudo dnf info sqlite

Continue with the SQLite reference to explore SQLite functions and SQL syntax.