UbuntuUbuntu Based

How To Install SQLite on Ubuntu 24.04 LTS

Install SQLite on Ubuntu 24.04

In this tutorial, we will show you how to install SQLite on Ubuntu 24.04 LTS. SQLite is a popular, lightweight, and self-contained SQL database engine that has become a staple in many software projects. Its simplicity, reliability, and cross-platform compatibility make it an ideal choice for embedded systems, mobile applications, and server-side scripting.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the SQLite database on Ubuntu 24.04 (Noble Numbat). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

  • A server running one of the following operating systems: Ubuntu and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies.
  • An Ubuntu 24.04 system with root access or a user with sudo privileges.

Install SQLite on Ubuntu 24.04 LTS Noble Numbat

Step 1. Updating the Package Repository.

It’s always a good practice to update your system’s repositories before installing new packages. Open a terminal and run the following command:

sudo apt update

This command will fetch the latest package information from the Ubuntu repositories, allowing you to install the most recent version of SQLite and its dependencies. Updating the package repository is crucial to maintaining the security and stability of your system.

Step 2. Installing SQLite Ubuntu 22.04.

With the repositories updated, you can now install SQLite using the following command:

sudo apt install sqlite3

 To verify that SQLite has been successfully installed, run the following command:

sqlite3 --version

This will display the version of SQLite installed on your system.

Step 3. Basic Usage of SQLite.

SQLite comes with a command-line interface (CLI) that allows you to interact with your database. To access the SQLite CLI, run the following command in your terminal:

sqlite3

This will open the SQLite prompt, where you can execute SQL commands.

Let’s create a simple database and table:

sqlite3 mydatabase.db

This command will create a new SQLite database file named mydatabase.db in your current working directory.

Now, let’s create a table named users with three columns: id, name, and email:

CREATE TABLE users (
id INTEGER PRIMARY KEY,
name TEXT,
email TEXT
);

To insert some data into the users table:

INSERT INTO users (name, email) VALUES
('Meilana Maria', 'mey@example.com'),
('Ranty Ratna', 'ranty@example.com'),
('Chedelics Radiks', 'chedelics@example.com');

Finally, let’s query the data from the users table:

SELECT * FROM users;

This will display all the rows and columns from the users table.

To exit the SQLite prompt, simply type:

.exit

Step 4. Installing SQLite Browser.

While the SQLite CLI is powerful, sometimes you may prefer a graphical user interface (GUI) for managing your databases. SQLite Browser is a popular open-source tool that provides a user-friendly interface for creating, designing, and editing SQLite database files.

To install SQLite Browser, run the following command:

sudo apt install sqlitebrowser

Once the installation is complete, you can launch SQLite Browser by searching for it in your applications menu or by running the following command in your terminal:

sqlitebrowser

SQLite Browser allows you to perform various tasks, such as creating new databases, designing tables, executing SQL queries, and browsing data.

If you ever need to remove SQLite from your system, you can do so by running the following command:

sudo apt remove sqlite3

Congratulations! You have successfully installed SQLite. Thanks for using this tutorial for installing the SQLite database on the Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the SQLite website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button