How To Install liblgpio-dev on Ubuntu 22.04

In this tutorial we learn how to install liblgpio-dev on Ubuntu 22.04. liblgpio-dev is Control GPIO pins via the kernels gpiochip device interface

Introduction

In this tutorial we learn how to install liblgpio-dev on Ubuntu 22.04.

What is liblgpio-dev

liblgpio-dev is:

The lgpio library is a fully featured library for controlling the GPIO pins of the local board. It includes facilities for software PWM, callbacks on level change, I2C, SPI, and UART wrappers.

This package contains the header files needed to use lgpio from C applications.

There are three methods to install liblgpio-dev on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install liblgpio-dev Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install liblgpio-dev using apt-get by running the following command:

sudo apt-get -y install liblgpio-dev

Install liblgpio-dev Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install liblgpio-dev using apt by running the following command:

sudo apt -y install liblgpio-dev

Install liblgpio-dev Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install liblgpio-dev using aptitude by running the following command:

sudo aptitude -y install liblgpio-dev

How To Uninstall liblgpio-dev on Ubuntu 22.04

To uninstall only the liblgpio-dev package we can use the following command:

sudo apt-get remove liblgpio-dev

Uninstall liblgpio-dev And Its Dependencies

To uninstall liblgpio-dev and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove liblgpio-dev

Remove liblgpio-dev Configurations and Data

To remove liblgpio-dev configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge liblgpio-dev

Remove liblgpio-dev configuration, data, and all of its dependencies

We can use the following command to remove liblgpio-dev configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge liblgpio-dev

References

Summary

In this tutorial we learn how to install liblgpio-dev package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.