add-apt-repository is normally installed by default in Ubuntu and Debian distribution, but not in some variance such as Raspberry Pi OS. As such, you'll get the following command not found error when trying to add a repository to your system;

$ sudo add-apt-repository ppa:ondrej/php
sudo: add-apt-repository: command not found

To have it on your system, you'll have to install software-properties-common like the following.

Steps to install add-apt-repository in Ubuntu / Debian:

  1. Update package information.
    $ sudo apt update
  2. Upgrade Installed packages.
    $ sudo apt upgrade --assume-yes
  3. Install software-properties-common.
    $ sudo apt --assume-yes install software-properties-common

Guide compatibility:

Operating System
Ubuntu 16.04 LTS (Xenial Xerus)
Ubuntu 16.10 (Yakkety Yak)
Ubuntu 17.04 (Zesty Zapus)
Ubuntu 17.10 (Artful Aardvark)
Ubuntu 18.04 LTS (Bionic Beaver)
Ubuntu 18.10 (Cosmic Cuttlefish)
Ubuntu 19.04 (Disco Dingo)
Discuss the article:

Comment anonymously. Login not required.