How to Install SQLite 3 on Ubuntu 22.04 | 20.04 LTS

SQLite is a compact database management system (DBMS) that does not require a server, here we learn the commands to install SQLite 3 on Ubuntu 22.04 Jammy or 22.04 Focal.

Unlike other server and client database servers such as MySQL, SQLite is a file-based relational database management system (RDBMS). It is available free to download and use, written in the C programming language. The best example to understand it, many times smartphone apps use SQLite, such as a browser to store cookies or bookmarks in .sqlite3/.sqlite/.DB file format. A great advantage of this format is that the databases only consist of one file and take up little space. If you want to open an SQLite file, you need a program that is compatible with this format.

That’s is the reason SQLite is a preferable choice of developers for using as embedded database software for local or client storage applications such as web browsers. In short, it offers a small, fast, self-contained, high-reliability, full-featured SQL database engine.

If you have just started developing an application and want to try out SQLite 3 to learn how this file-based database works, then here are the commands to install SQLite 3 on Ubuntu 22.04 or 20.04 LTS Linux systems.

Steps to install SQLite 3 on Ubuntu 22.04 | 20.04 LTS

Requirements

• A Debian based Linux such as Ubuntu
• Non-root sudo user
• Internet connection for online installation

#1st way:

Apt Update Command

On your command terminal, first, run the system update command to let the system update its existing packages as well as refresh the cache of repositories.

sudo apt update -y

 

Install SQLite 3 on Ubuntu 22.04 | 20.04 with APT

We don’t need to add any third-party repository to install SQLite 3 on our system. What we have to do is- run the APT package manager command to install this file-based database.

sudo apt install sqlite

command to install SQLite 3 on Ubuntu 20.04 or 22.04

 

Check version

Once the installation is completed, we can check what version is exactly we got of the SQLite database on our Ubuntu system using the APT package manager.

sqlite3 --version

Check Sqlite version on ubuntu

 

#2nd Way

Installing SQLite 3 by compiling its source

Those who don’t want to use the APT package manager can compile this file-based database directly using its source code.

Install developer tools

To compile the source of some applications on Linux we need some developer’s tools, to get them we just need to install the Build Essential package.

Build essential is a name for a package that includes the GCC/g++ compilers and libraries and some other utilities required to compile software written in C and C++.

The Gnu Compiler Collection, GCC for short, is a collection of compilers and offers a uniform interface for creating programs in C, C ++, Objective-C, Fortran, Ada, Assembler and Go.

sudo apt install build-essential -y

Download source code

Visit the SQLite Download page and click on the Tar.GZ  file available for it.

compile SQlite from its source on Ubuntu

 

Unzip the zipped file:

cd Downloads

Check the file is available there:

ls

Now, use the given syntax to extract it:

tar xvfz filename.tar.gz

example: Don’t forget to replace sqlite-autoconf-3370200 with your file version.

tar xfvz sqlite-autoconf-3370200.tar.gz

Create a directory to safely place the file under /opt:

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

cd /opt/sqlite3

Run configure file to build the code for installation 

./configure --prefix=/usr/local

Install SQLite using the Make command  

sudo make install

Check version:

sqlite3 --version

For further knowledge, the user can visit SQLite Documentation.

 

Other Articles:

• How to create, compile & run a C Program in a Linux terminal
• How to Install Cockpit on Ubuntu 22.04
• Install Gitlab on Ubuntu 20.04 LTS Focal fossa

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.