SQLite is a free, lightweight relational database management system (RDBMS) in a C library. SQLite is not a client-server database engine. Instead, it is embedded into the end program. Primarily all programming languages support SQLite, which how languages embed the program is with a file with .sqlite3/.sqlite/.DB extension. The software is a popular choice for local/client storage such as web browsers, Android devices, and much more. The list is quite extensive.
In the following tutorial, you will learn how to install SQLite 3 along with Debian 11 Bullseye.
- Recommended OS: Debian 11 Bullseye.
- User account: A user account with sudo or root access.
Update Operating System
Update your Debian operating system to make sure all existing packages are up to date:
sudo apt update && sudo apt upgrade -y
The tutorial will be using the sudo command and assuming you have sudo status.
To verify sudo status on your account:
Example output showing sudo status:
[joshua@debian~]$ sudo whoami root
To set up an existing or new sudo account, visit our tutorial on Adding a User to Sudoers on Debian.
To use the root account, use the following command with the root password to log in.
The tutorial will utilize the terminal for the installation found in Activities > Show Applications > Terminal.
Option 1. Install SQLite 3 on Debian with APT
The first option and recommended to start with is to install SQLite 3 from Debian 11 Bullseyes repository. To begin the installation, use the following command in your terminal.
sudo apt install sqlite3
Next, verify the version installed of SQLite 3 with the –version command.
Option 2. Install SQLite 3 on Debian by Compiling
As many Debian users would know, the version featured in Debian’s repository is not always the most up to date and compiling can give you the latest, or for that matter, a preferred version.
First, install the build-essentials package.
sudo apt install build-essential
Type Y, then press the ENTER KEY to proceed.
Next, visit the SQLite Download page and grab the latest version link and download it using the wget command.
Extract the files to that directory you just created.
tar xvfz sqlite-autoconf-3370200.tar.gz
Move the file to the directory created earlier.
sudo mv sqlite-autoconf-3370200 /opt/sqlite3
Now, you will navigate to the folder to begin compiling SQLite.
Begin the compiling process using the following command.
The next process is to use the (make) command to start the build process. A better way to do this is to specify the number of cores you want to use in compiling to speed up the process.
make -j 2
Note, the (-j) corresponds to the number of cores in your system to speed up the build time. If you have a powerful server, you can set this as high as possible. If you don’t, it will be the default option of 1. To find out how many cores you have on your system, execute the following code:
As you can see, we have two cores, so in the (make) command, we used (-j 2). However, if you have 12 cores, you could have -j 6 cores and dedicate half or more to the process.
Once the build process is complete, begin the installation using the following command.
sudo make install
Once installed, verify the installation and the version number.
As above, the version is 3.37, whereas the Debian repository version is at 3.34 at the time of this tutorial.
Comments and Conclusion
The tutorial has shown how to install SQLite 3 using the APT method or compiling from source with Debian 11 Bullseye. Overall, SQLite 3 is basic but powerful. However, it is acceptable for small to medium websites for large growing sites to look at MariaDB, MongoDB, and PostgreSQL, among many other options.
For more information on building applications with SQLite, visit the official documentation page.