In order to install PHP version 8.0, first, open your Ubuntu Terminal and enter the following command in order to add the Ondrej PHP repository to your Ubuntu system (in case you have not done that already in the above chapter to install PHP 5.6).
$ sudo add-apt-repository ppa:ondrej/php
This repository contains all the released versions of PHP till date.
Once the Ondrej repository is added, you need to update your system’s repository with that on the internet. This way you can install the latest available version of a software on your system. Enter the following command in order to do so: