Before installing PHP CLI and XDEBUG on Linux, you should update the system repositories. This ensures that all of your systems software is up-to-date, reducing the likelihood of compatibility issues. Open a terminal and run the following commands.

sudo apt update
sudo apt upgrade -y

Next, run the following command to install PHP CLI:

sudo apt install php-cli

And finally, run the following command to install XDEBUG:

sudo apt install x-debug