How To Install fpc on Ubuntu 22.04

In this tutorial we learn how to install fpc on Ubuntu 22.04. fpc is Free Pascal - SDK suite dependency package

Introduction

In this tutorial we learn how to install fpc on Ubuntu 22.04.

What is fpc

fpc is:

The Free Pascal Compiler is an Object Pascal compiler supporting both Delphi and Turbo Pascal 7.0 dialects, as well as Mac Pascal dialects. It provides a completely portable RunTime Library (RTL) available on many platforms and compatible with Turbo Pascal, along with a platform-independent class-based Free Component Library (FCL) adding many Delphi extensions and interfacing with many popular open source libraries.

Extensions have been added to the language, such as function overloading, creation and linking of shared libraries, and Delphi language extensions including classes, exceptions, ANSI strings, and open arrays.

This dependency package always depends on the latest available version of the metapackage pulling in all the FPC packages provided for this architecture. Experienced users may instead prefer to install the particular packages they require by hand.

There are three methods to install fpc 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 fpc Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install fpc

Install fpc Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install fpc using apt by running the following command:

sudo apt -y install fpc

Install fpc 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 fpc using aptitude by running the following command:

sudo aptitude -y install fpc

How To Uninstall fpc on Ubuntu 22.04

To uninstall only the fpc package we can use the following command:

sudo apt-get remove fpc

Uninstall fpc And Its Dependencies

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

sudo apt-get -y autoremove fpc

Remove fpc Configurations and Data

To remove fpc configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge fpc

Remove fpc configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge fpc

References

Summary

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