18 C
Texas
angeloma
Senior Writer and partner

How to install SQLite on CentOS 8?

In a system or a computer network, when we read on a database, we think of MySQL. We may even think of PostgreSQL or MariaDB but rarely SQLite. But the truth is that SQLite is very powerful and light. In this post, we’ll show you how to install SQLite on CentOS 8 and take the first steps with the program.

SQLite small but powerful

Unlike MySQL, MariaDB or PostgreSQL, SQLite does not function as a system service that can be managed from systemctl. Rather it is a rather small and lightweight self-contained database manager.

On the other hand, being so small does not make it less powerful, but on the contrary supports databases up to 2 Terabytes in size. It is an acceptable size and enough for many cases.

The application is open-source and cross-platform with binaries for Linux, Windows and macOS. In addition, it is self-contained i.e. it does not require external libraries to work. This and the fact that it is done in C language make it a very efficient database management system.

- Advertisement -

Finally, there is no need to worry about the data, because they are perfectly compatible with the popular MySQL or PostgreSQL.

Install SQLite on CentOS 8

In this new version of CentOS, we have a very recent version of SQLite in the official repositories. This makes the installation really simple.

First, open a terminal and update the system:

:~$ su
:~# dnf update

This way you will have all the security patches installed correctly in your system. With this your system will be more secure and stable.

Then, proceed to install SQLite using the following command:

:~# dnf install sqlite
1.- Install SQLite on CentOS 8
1.- Install SQLite on CentOS 8

At the end of the download to install will be ready for work. It’s that simple.

Working with SQLite on CentOS 8

To enter the SQLite command console, simply type the SQLite command. There you create a temporary database to start the work.

:~$ sqlite3
2.- Access to the SQLite command shell
2.- Access to the SQLite command shell

A second step I recommend is to show the SQLite help to know which commands we can apply. At least at the beginning, it is good to do it.

> .help
3.- Help screen of SQLite
3.- Help screen of SQLite

If you want to create a new permanent database, you must exit the shell and execute the sqlite3 command followed by the name of the database to be created.

To exit the shell, use .exit.

:~$ sqlite3 example.db
4.- Creating a new database on SQLite
4.- Creating a new database on SQLite

And on it create a new table with a simple structure like the one I will do. Of course in daily work, these tables will be long and complex.

> create table example(
...> id int(3),
...> name varchar(30),
...> last_name varchar(30)
...> );
5.- Creating a new table with SQLite on CentOS 8
5.- Creating a new table with SQLite on CentOS 8

Then, you can insert some data:

> INSERT INTO example(id,name,last_name) VALUES(1,'Angelo','Osradar);

Then, Check the results:

> SELECT * FROM example;
6.- Using SQLite on centOS 8
6.- Using SQLite on centOS 8

Now, you can start to work with SQLite on CentOS 8.

Conclusion

With SQLite we will have the certainty of using a good database manager but without spending too many resources. This way we will be able to have a database of considerable sizes with an amazing speed. In this post, you have learned to use it and take the first steps with it.

Please share this post and join our Telegram channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article