×


Install SQLite on Debian 11 - Step by step guide ?

SQLite is a lightweight and fully-featured software library that provides an SQL database engine which is Written in C language.

Unlike conventional relational databases such as PostgreSQL and SQL, SQLite is serverless and does not require any configuration. Also, give its serverless architecture, it does not have a daemon or process that needs to be started or stopped. SQLite requires minimal support from external libraries or from the operating system. As such it is ideal for use in embedded devices such s smartphones, gaming consoles, portable media players etc.

Here at Ibmi Media, we shall look into how you can install SQLite on Debian 11.


Different ways of installing SQLite on Debian

  • SQLite installation via APT.
  • SQLite installation from source.


1. SQLite installation via APT

SQLite can be found in the default debian 11 repositories. Install it using APT with the below command:

$ sudo apt install sqlite3


2. SQLite installation from source

To install the latest version, consider manually compiling the source code.

First, install basic compiler packages. Run:

$ sudo apt install build-essential

Then, create a directory to hold SQLite3 and its contents:

$ mkdir /opt/sqlite3

Thereafter, head over to the official SQLite download page and grab the latest binary file:

$ wget https://www.sqlite.org/2022/sqlite-autoconf-3370200.tar.gz

Extract the archive file:

$ tar xvfz sqlite-autoconf-3370200.tar.gz

Next, move the decompressed folder to the directory you created above:

$ sudo mv sqlite-autoconf-3370200 /opt/sqlite3

Next, navigate to the SQLite folder:

$ cd /opt/sqlite3/sqlite-autoconf-3370200

The next step is to start the compiling process by executing the command:

$ ./configure

After that, start the build process with the make command:

$ make -j 2

The -j represents the number of cores present in your system. This helps you speed up the build process. To verify the number of CPU cores present on your system, invoke the nproc command:

$ nproc

Finally, initiate the build process to install SQLite 3:

$ sudo make install


How to verify SQLite installation ?

You can confirm the version of SQLite installed with the command:

$ sqlite3 --version


How to Test SQLite on your Debian system ?

Now that SQLite is successfully installed on our system, To create a new database or to open an existing one, you can use the sqlite3 command:

$ sqlite3 new_db

You can create a table "linux" with two columns, name and version:

CREATE TABLE linux(name String, version Int);

Next, insert some data in this newly created table:

INSERT INTO linux VALUES("Ubuntu", 21), ("Debian",11), ("Gnome", 40);

You can see the tables that are available in the database with .tables:

.tables;

select * from linux;


How To Uninstall sqlite on debian 11 ?

To uninstall only the sqlite package we can use the following command:

$ sudo apt-get remove sqlite


[Need support in fixing Debian Linux system issues ? We can help you. ]


Conclusion

This article covers how to install the latest version of SQLite on Debian 11 Bullseye. In fact, SQLite is a C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine.