how to install SQLite 3 on Ubuntu

How to install SQLite 3 and SQLite Browser on Ubuntu 22.04 LTS

In this short article we will discuss how to install SQLite 3 and SQLite Browser on Ubuntu 22.04 LTS operating system.

Introduction

In the ever-evolving world of database management systems, SQLite 3 stands out as a reliable, lightweight, and versatile choice. As a self-contained, serverless, and zero-configuration relational database, SQLite3 offers a wide range of applications across various industries. In this article, we will explore the key features, benefits, and use cases of SQLite 3, shedding light on why it remains a popular choice for developers and organizations worldwide.

Key Features of SQLite 3

1. Serverless and Zero-Configuration

SQLite3 doesn’t need a separate server process to run. You can create a database file and start using it immediately, making it extremely easy to set up.
2. Self-Contained

The entire database engine is contained in a single library file, which makes it a perfect choice for embedded systems, mobile apps, and standalone desktop applications.
3. Transactional

SQLite3 supports fully atomic, consistent, isolated, and durable (ACID) transactions, ensuring data integrity even in the face of power losses or system crashes.
4. Cross-Platform

SQLite3 is cross-platform and runs on virtually all major operating systems, including Windows, macOS, Linux, iOS, and Android.
5. Low Memory Footprint

SQLite3 is designed to be memory-efficient, making it suitable for resource-constrained environments.
6. SQL Compatibility

Installing SQLite 3 On Ubuntu 22.04 LTS

There are two ways to install SQLite3 on the Ubuntu 22.04 Linux operating system, namely:

  • Using default package repository
  • Downloadinpackage from the official SQLite 3 website

In this tutorial we will only discuss installing SQLite 3 on Ubuntu by using default repository.

Installing SQLite 3 Using Default Package Repository

By using this method we will use default Ubuntu 22.04 default repository to install SQLite3. For this purpose we will do the following steps:

  • Checking SQLite3 package Repository
  • Installing SQLite3
  • Verifying SQLite3 Installation

1. Checking SQLite3 Package Default Repository

In this step, we will ensure if the SQLite package repository on the system. For this purpose we will submit the following command line :

$ sudo apt show sqlite3

Output :

ramansah@infodiginet:~$ sudo apt show sqlite3
[sudo] password for ramansah: 
Package: sqlite3
Version: 3.37.2-2ubuntu0.1
Priority: optional
Section: misc
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Laszlo Boszormenyi (GCS) <gcs@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1.873 kB
Depends: libc6 (>= 2.34), libreadline8 (>= 6.0), zlib1g (>= 1:1.2.0), libsqlite3-0 (= 3.37.2-2ubuntu0.1)
Suggests: sqlite3-doc
Homepage: https://www.sqlite.org/
Download-Size: 768 kB
APT-Sources: http://id.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
Description: Command line interface for SQLite 3
SQLite is a C library that implements an SQL database engine.
Programs that link with the SQLite library can have SQL database
access without running a separate RDBMS process.

Based on the package information above, if the system has already had SQLite3 package with version 3.37.2.

2. Install SQLite3 On Ubuntu 22.04

After SQLite package has been confirmed, then we will install it by using command line :

$ sudo apt install sqlite3 -y

Output :

ramansah@infodiginet:~$ sudo apt install sqlite3 -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
sqlite3-doc
The following NEW packages will be installed:
sqlite3
0 upgraded, 1 newly installed, 0 to remove and 231 not upgraded.
Need to get 768 kB of archives.
After this operation, 1.873 kB of additional disk space will be used.
Get:1 http://id.archive.ubuntu.com/ubuntu jammy-updates/main amd64 sqlite3 amd64 3.37.2-2ubuntu0.1 [768 kB]
Fetched 768 kB in 1s (741 kB/s) 
Selecting previously unselected package sqlite3.
(Reading database ... 283647 files and directories currently installed.)
Preparing to unpack .../sqlite3_3.37.2-2ubuntu0.1_amd64.deb ...
Unpacking sqlite3 (3.37.2-2ubuntu0.1) ...
Setting up sqlite3 (3.37.2-2ubuntu0.1) ...
Processing triggers for man-db (2.10.2-1) ...

how to install SQLite 3 on Ubuntu

3. Verify SQLite3 Installation

After SQLite3 installation is completed done, then we will verity it by submitting command line :

$ sqlite3 --version

Output :

ramansah@infodiginet:~$ sqlite3 --version
3.37.2 2022-01-06 13:25:41 872ba256cbf61d9290b571c0e6d82a20c224ca3ad82971edc46b29818d5dalt1

4. Starting SQLite 3

To run SQLite 3 we wil use the following commands :

$ sqlite3

Output :

ramansah@infodiginet:~$ sqlite3
SQLite version 3.37.2 2022-01-06 13:25:41
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .help
.archive ... Manage SQL archives
.auth ON|OFF Show authorizer callbacks
.backup ?DB? FILE Backup DB (default "main") to FILE
.bail on|off Stop after hitting an error. Default OFF
.binary on|off Turn binary output on or off. Default OFF
.cd DIRECTORY Change the working directory to DIRECTORY
.changes on|off Show number of rows changed by SQL
.check GLOB Fail if output since .testcase does not match
.clone NEWDB Clone data into NEWDB from the existing database
.connection [close] [#] Open or close an auxiliary database connection
.databases List names and files of attached databases
.dbconfig ?op? ?val? List or change sqlite3_db_config() options
.dbinfo ?DB? Show status information about the database
.dump ?OBJECTS? Render database content as SQL
.echo on|off Turn command echo on or off
.eqp on|off|full|... Enable or disable automatic EXPLAIN QUERY PLAN
.excel Display the output of next command in spreadsheet
.exit ?CODE? Exit this program with return-code CODE
.expert EXPERIMENTAL. Suggest indexes for queries
.explain ?on|off|auto? Change the EXPLAIN formatting mode. Default: auto
.filectrl CMD ... Run various sqlite3_file_control() operations
.fullschema ?--indent? Show schema and the content of sqlite_stat tables
.headers on|off Turn display of headers on or off
.help ?-all? ?PATTERN? Show help text for PATTERN

run SQLite 3

Installing SQLite Browser

SQLite Browser, also known as DB Browser for SQLite, is an open-source and cross-platform desktop application designed for managing, viewing, and editing SQLite database files. SQLite is a self-contained, serverless, and zero-configuration database engine, and SQLite Browser provides an intuitive interface to interact with SQLite databases.

How To Install SQLite Browser On Ubuntu 22.04

In this tutorial we will instal SQLite Browser by using default package repository. To install it we will submit the following command line :

$ sudo apt install sqlitebrowser

Output :

ramansah@infodiginet:~$ sudo apt install sqlitebrowser
[sudo] password for ramansah: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libdouble-conversion3 libmd4c0 libpcre2-16-0 libqscintilla2-qt5-15 libqscintilla2-qt5-l10n libqt5core5a
libqt5dbus5 libqt5gui5 libqt5network5 libqt5printsupport5 libqt5svg5 libqt5widgets5 libqt5xml5
libxcb-xinerama0 libxcb-xinput0 qt5-gtk-platformtheme qttranslations5-l10n
Suggested packages:
libqscintilla2-doc qt5-image-formats-plugins qtwayland5
The following NEW packages will be installed:
libdouble-conversion3 libmd4c0 libpcre2-16-0 libqscintilla2-qt5-15 libqscintilla2-qt5-l10n libqt5core5a
libqt5dbus5 libqt5gui5 libqt5network5 libqt5printsupport5 libqt5svg5 libqt5widgets5 libqt5xml5
libxcb-xinerama0 libxcb-xinput0 qt5-gtk-platformtheme qttranslations5-l10n sqlitebrowser
0 upgraded, 18 newly installed, 0 to remove and 231 not upgraded.
Need to get 15,7 MB of archives.
After this operation, 59,7 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

. . .

Setting up sqlitebrowser (3.12.1-2) ...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...

Running SQLite Browser

To run the SQLite Browser, we just search for the SQLite Browser in the Application Menu.Then  we will find the SQLite Browser main page as shown below :

SQLite Browser

 

Uninstall SQLite 3 From Ubuntu 22.04

In this section we will learn how to uninstall/remove SQLite 3 from the system. To remove SQLite 3 from Ubuntu 22.04 LTS system, we will submit the following command line :

$ sudo apt purge sqlite3 -y

Output :

ramansah@infodiginet:~$ sudo apt purge sqlite3 -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
sqlite3*
0 upgraded, 0 newly installed, 1 to remove and 231 not upgraded.
After this operation, 1.873 kB disk space will be freed.
(Reading database ... 283653 files and directories currently installed.)
Removing sqlite3 (3.37.2-2ubuntu0.1) ...
Processing triggers for man-db (2.10.2-1) ...

Conclusion

In this short article we have installed SQLite 3 and SQL Browser on Ubuntu 22.04 LTS operating system. SQLite Browser is a valuable tool for anyone working with SQLite databases, offering a user-friendly interface and a wide range of features for database management and exploration. Whether you’re a developer, data analyst, researcher, or educator, SQLite Browser simplifies the process of interacting with SQLite databases, making it easier to create, modify, and explore data.

(Visited 106 times, 1 visits today)

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *