SQLite is one of the Relational C-library DBMS(Database Management System). SQLite is not a client-server Database Engine as opposed to several other Database Management Systems. SQLite is a common pick in application software, such as web browsers,as a local/client storage integrated Database System. It is probably the most frequently used database engine because it is used by many widely known browsers, Operating Systems, mobile applications and embedded systems today. SQLite records the whole database on a host system as a single platform file.

File-based is SQLite. It is not the same as other SQL Databases because SQLite has no separate server process, as is the case with most other SQL databases. Installation process of SQLite on Debian 11(Linux OS) by Two methods is explained in the Article:

  • How to install SQLite from Debian Repository
  • How to Install SQLite using SQLite website

Before installation of SQLite from any of the one method update the packages:

Updating Packages

It is important to ensure your system is up-to-date before installation of any software by running the below mentioned command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image1-14.png" data-lazy- height="405" src="data:image/svg xml,” width=”979″>

Now to get latest version of all installed packages on your system, upgrade your packages by running below mentioned command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image3-12.png" data-lazy- height="288" src="data:image/svg xml,” width=”976″>

Now all my packages are updated and upgraded.

Method 1: How to install SQLite from Debian Repository

As SQLite is already present in the Debian 11 repository, we can easily install the SQLite from the repository but that is not the latest version of SQLite.

Step1:  Installing SQLite on Debian 11

Run the below mentioned command to install the available version of SQLite from Debian 11 repository:

$ sudo apt install sqlite3

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image2-13.png" data-lazy- height="531" src="data:image/svg xml,” width=”973″>

Step2: Checking Version

To verify the installation, check version number of SQLite by below mentioned command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image5-13.png" data-lazy- height="262" src="data:image/svg xml,” width=”968″>

Method 2:  How to Install SQLite using SQLite website

The latest stable version of SQLite at the time of writing this article is “3.36.0” but unfortunately in Debian 11 repository, the latest version is not available. So to install the latest version directly from SQLite web page we will use wget and tar command.

Follow the steps below to successfully install the latest version:

Step 1: Installing build tools

First we need to install the build tools for construction of package, run the below mentioned command to install “build-essentials”:

$ sudo apt install build-essential

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image4-13.png" data-lazy- height="628" src="data:image/svg xml,” width=”971″>


Step2: Getting SQLite Source code

To install SQLite source code, go to SQLite website, check for the latest version or any version you want to install and copy its source code link; in my case the latest is 3.36.0. Now download it using below mentioned command:

wget –c https://www.sqlite.org/2021/sqlite-autoconf-3360000.tar.gz

You can replace SQLite source code link if you are installing some other version in wget command.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image7-10.png" data-lazy- height="476" src="data:image/svg xml,” width=”965″>

Step3:  Extracting the Source code

Run the below mentioned command to create a separate directory to extract the source code in that folder:

You can set the name of directory according to your choice:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image6-11.png" data-lazy- height="147" src="data:image/svg xml,” width=”972″>

Now move to newly created directory by below mentioned command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image9-7.png" data-lazy- height="165" src="data:image/svg xml,” width=”967″>

Now extract the source code of SQLite by tar command:

$ tar xvfz ../sqlite-autoconf-3360000.tar.gz

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image8-10.png" data-lazy- height="626" src="data:image/svg xml,” width=”965″>


Step4: Compiling Source code of SQLite

To compile extracted source code first you need to get access to generated folder by below mentioned command:

$ cd sqlite-autoconf-3360000/

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image12-5.png" data-lazy- height="159" src="data:image/svg xml,” width=”967″>

To start compiling, configure the code by below mentioned command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image10-6.png" data-lazy- height="627" src="data:image/svg xml,” width=”963″>

Now use the make command to build libraries and executable files from source code of SQLite:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image11-5.png" data-lazy- height="628" src="data:image/svg xml,” width=”989″>

Step5: Installing SQLite

Now install the sqlite 3.36.0 version with the help of the make command by running below mentioned command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image13-4.png" data-lazy- height="625" src="data:image/svg xml,” width=”981″>

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image14-2.png" data-lazy- height="626" src="data:image/svg xml,” width=”974″>

Step6: Verifying Installation

To verify the installation of latest version of SQLite, check the version number by below mentioned command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image15-1.png" data-lazy- height="219" src="data:image/svg xml,” width=”979″>

How to test SQLite

After successful installation of SQLite, you can create a database and table to test its working.

Create Database “linuxhint.db” with help of sqlite3 command as mentioned below:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image16-1.png" data-lazy- height="282" src="data:image/svg xml,” width=”980″>

Now create the table “linux” with parameters (name String,version INT) by below mentioned code:

CREATE TABLE linux(name String,version INT);

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image17-1.png" data-lazy- height="259" src="data:image/svg xml,” width=”981″>

Insert data in to newly created table:

INSERT INTO linux VALUES(“Debian”,11),(“Ubuntu”,21);

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image18.png" data-lazy- height="309" src="data:image/svg xml,” width=”981″>

Now get data from “linux” table by below mentioned query:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/image19.png" data-lazy- height="114" src="data:image/svg xml,” width=”975″>

You can write more queries according to your requirement; this was just a sample to show you how SQLite works in Debian 11 terminal.

Conclusion:

SQLite is a file-based relational Database, it contains C-library. It is a commonly used Database Engine mostly used in mobile applications. It records the whole Database on a host system as a single platform file. In this article we have discussed the installation of SQLite on Debian 11 by two methods; from Debian 11 repository and by SQLite website using wget command. Also the working of SQLite using sqlite3 command on terminal is discussed. After reading this article you will be able to successfully install and use SQLite on your Debian 11 system.

About the author

<img alt="" data-lazy-src="https://secure.gravatar.com/avatar/7c99efcc024949e17b176845c757687e?s=112&r=g" data-lazy- height="112" src="data:image/svg xml,” width=”112″>

Alishba Iftikhar

I am currently an undergraduate student in my 1st year. I am an internee author with Linuxhint and loved learning the art of technical content writing from senior authors. I am looking forward to opting my career as a full time Linux writer after I graduate.