Installation on Linux: Install FPC from the repositories

Installing from the repositories is only recommended for FreePascal (FPC from now on), because Lazarus needs a homeuser install, otherwise you would have to change permissions on folders on systems where it is not safe to move.

In this installation, we will use FPC from the repositories, but Lazarus will be installed by fpcupdeluge. First let's install some essential packages:

(se seu sistema for Redhat-like como o Fedora)
sudo dnf install make automake gcc gcc-c++ kernel-devel
sudo dnf groupinstall "Development Tools" "Development Libraries"
sudo dnf install gdb zip unzip subversion binutils libX11-devel gtk2-devel gdk-pixbuf2-xlib
sudo dnf install cairo cairo-devel cairomm-devel
sudo dnf install pango pango-devel pangomm pangomm-devel

(se seu sistema for Debian-like como o Ubuntu)
sudo apt install -y build-essential 
sudo apt install -y wget curl lzip tar unzip squashfs-tools
sudo apt install -y gdb zip unzip subversion binutils libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev
sudo apt install -y libcairo2 libcairo2-dev libcairomm-1.0-dev libpangomm-1.4-dev

The FPC source code will also be required, so run:

(se seu sistema for Redhat-like como o Fedora)
sudo dnf install fpc fpc-src qt5pas-devel
(se seu sistema for Debian-like como o Ubuntu)
sudo apt-get install -y fpc fpc-source  libqt5pas-dev

On both Windows and Linux it is essential to know where the freepascal source files are located, so run:

(se seu sistema for Redhat-like como o Fedora)
rpm -ql fpc-src
(se seu sistema for Debian-like como o Ubuntu)
dpkg -L fpc-source
(...)
/usr/share/fpcsrc/rtl/x86_64/set.inc
/usr/share/fpcsrc/rtl/x86_64/setjump.inc
/usr/share/fpcsrc/rtl/x86_64/setjumph.inc
/usr/share/fpcsrc/rtl/x86_64/strings.inc
/usr/share/fpcsrc/rtl/x86_64/stringss.inc
/usr/share/fpcsrc/rtl/x86_64/x86_64.inc (...)

If you took a good look at the output of the command, they are all in the root of the folder:

/usr/share/fpcsrc

Make a note of this path because it will be important for configuring the Lazarus IDE or vscode. With FPC installed on your system you are able to install Lazarus via GIT or fpcupdeluge. In order not to be too repetitive, choose how you want to install Lazarus:

The. Using fpcupdeluge (medium level)

B. Using GIT as installer (medium level+1)

If you decide to use fpcupdeluge, be careful to customize the installation by going to the Setup+ and turning on the option Use system FPC for Lazarus:

Checking the “Use system FPC” option

The above option when checked will make fpcupdeluge reuse the pre-installed fpc, otherwise you will face a bunch of fpc downloads and builds which in my modest opinion is not worth it.

If you felt difficulty in the article, watch the video below: