Looking to install SQLite on Fedora Linux?
You’re in the right place.
This tutorial will walk you through the different methods of installing (and using) SQLite on your Fedora system.
I’ll also show you some basic commands and uses of this database engine so you can get started immediately.
Note: For demonstration purposes, I will be using Fedora Linux 38 with Xfce Desktop Environment.
What You’ll Need
Before going into the main tutorial, check if you have everything in place:
- Fedora installed and running (guide)
- Familiarity with the Command Line Interface (CLI) and CLI commands (guide)
- Root account or sudo privileges (guide)
- A stable internet connection
If you have everything necessary, then let’s continue to the next section.
How to Install SQLite on Fedora: Step-By-Step
In this tutorial, I’ll show you three different methods of installing SQLite on Fedora.
Let’s go through the first method:
Step 1: Install SQLite on Fedora
Method 1: Install SQLite on Fedora From the Official Repository (Easiest)
This is the most straightforward method of installing SQLite on Fedora Linux.
- Open your terminal.
- Before installing new software, you should ensure you have your Fedora system up-to-date by updating all the software and dependencies. This will remove any possibility of conflicts between packages. You can update your system with this command:
sudo dnf upgrade --refresh
- When the update is complete, you are ready to install SQLite. Install SQLite on Fedora Linux by running the below command:
sudo dnf install sqlite
- After installing SQLite, you’ll need some extra packages to use it. These packages are for the development tools related to SQLite and to extend the database engine’s functionality. Install those packages with this command:
sudo dnf install sqlite-devel sqlite-tcl
You’re now ready to use SQLite on Fedora.
Method 2: Install SQLite on Fedora From Binary Files
A binary file is a precompiled executable file. Usually, you can fetch these files from the official website and run them on your system to install that particular software.
- First, go to the SQLite download page. In the left sidebar, you will see a download option for Linux. Click on that link to download the binary file.
- You can also use the command line to do this. To download the file using the terminal, run this command:
Note: The version number might differ depending on when you’re reading this. So keep that in mind.
- The file is in ZIP format. So you will need to extract it first. Extract the ZIP file with this command:
unzip sqlite-tools-linux-x86-3430100.zip -d ./sqlite
Notice that I’ve created a directory called sqlite to store the extracted files.
- Now I will add this new directory path to the PATH variable. This will allow the system to search for the specific directory to find executable files before searching the others. To do this, run the below command:
- To check if it worked, use this command:
As you can see from the above screenshot, you can see the specified file path.
Method 3: Install SQLite on Fedora From the Source File
This is the most challenging method out of the three. If you’re an experienced Linux user and prefer to build things from source, proceed with this method.
- Since you’ll be building a software from source, some development tools will be required. It’s a large collection of files so you need to wait patiently. Install the required tools with this command:
sudo dnf groupinstall "Development Tools" "Development Libraries"
- Next, download the source file from the official webpage. Visit the page and click the download link:
- Again, if you prefer to use the command line to download files, run this command in your terminal:
- It’s an archived file. Unzip the file with this command:
tar -xvf sqlite-autoconf-3430100.tar.gz
- You should notice a new directory created in the location where you extracted the file. Go into the location with this command:
- There’s a script called configure in this directory. Run that script in the below format:
With –prefix=/usr, you will be specifying /usr the installation directory for SQLite.
- Now you will need to compile the source code. For that, run the below command:
Let’s understand the command:
- -j – This option tells the system to run multiple jobs in parallel.
- $(nproc) – retrieves the number of available CPU cores on your device. Overall, this fastens the compilation process quite a bit.
- After you’re done compiling the file, it’s time to install it. Install SQLite with this command:
sudo make install
And that ends the process for installing SQLite on Fedora from its source files.
Step 2: Confirm Your SQLite Installation
After going through any of the above installation processes, you should check if the installation was successful. The easy way to do that is by checking the current version of SQLite.
- To check the version of SQLite, run the below command:
As you can see from the screenshot above, it returns the current installed version, verifying that SQLite on Fedora has been successfully installed.
The Beginner’s Guide to Using SQLite on Fedora Linux: Quick & Simple
Now that you’re done installing it, let’s see some of the basics of the SQLite database engine to get you started.
For working with SQLite, the
sqlite3 command will be used, as you will see in the examples below.
1. Create a New Database
The first thing to do with SQLite is create a database. To create a database, run the following command:
sqlite3 <database name>.db
This creates a new database for us or opens a database if it already exists with the same name. After running this command, you will be brought to a different command prompt. You can enter SQLite commands in this prompt to manage your databases.
2. Create a Table
Let’s now create a table in our new database. Let’s create a table called students. To do that, enter the query in the below format:
CREATE TABLE students (roll INTEGER PRIMARY KEY, first_name TEXT, last_name TEXT);
I created a table named students that contains three columns: roll, first_name, and last_name. The roll column stores integer-type data, while the other two columns store text or strings.
3. Insert New Data Into the Table
Now let’s enter some new data into the table I created. To insert data, use the following command:
INSERT INTO students (roll, first_name, last_name) VALUES (23, ‘Zunaid’, ‘Ali’); INSERT INTO students (roll, first_name, last_name) VALUES (24, John’, Doe’);
You can use a query to fetch the inserted data and check if it worked. Use the following command:
SELECT * FROM students;
Notice that the data were inserted as expected.
4. Update a Row
If you need to update the information of a single row, you can do that as well. Let’s change the roll of our first row. For that, run the below command:
UPDATE students SET roll = 11 WHERE roll = 10;
I’ve updated the roll from 23 to 11, as seen in the above screenshot.
5. Delete a Row
You can completely remove a row from a table. This can be done with this command:
DELETE FROM students WHERE roll = 24;
In this example, I’ve deleted the second row from our table.
6. List All Tables
If you want to see what tables exist in your database, simply use the below command:
I only created one table, and you can see that being displayed. When you’re done with everything, you can exit the SQLite prompt using this command:
Congratulations on installing SQLite on Fedora Linux!
In this guide, I’ve shown you the different methods of installing the SQLite database engine on Fedora.
For beginners, I recommend the first method as it takes the least amount of time and effort.
However, if the first method doesn’t work, you can try out the other methods.
I’ve also covered some basic commands so that you can try and test SQLite on your system immediately.
If this guide helped you, please share it.