How to add the repository using the add-apt-repository command in Ubuntu
The general syntax of adding the repository in the Ubuntu 22.04 using the add-apt-command is:
Simply using the command, we can add the repository with some options (options are not mandatory to use) so now we will add the Blender PPA repository:
We have seen that the PPA repository has been added successfully and then we will update the repository of the Ubuntu 22.04:
The PPA repository of the Blender has been added and now the Blender package can be installed using the apt package manager.
How to remove the repository using the add-apt-repository command in Ubuntu
We can remove the repository from the list of the /etc/apt/sources.list.d using the add-apt-repository, as we are going to remove the above-added blender repository with its remove option:
How to fix sudo: add-apt-repository: command not found
While adding some PPA repositories, you may face such an error, “sudo : add-apt-repository: command not found” oas shown in the image below:
This error can be resolved by installing software-properties-common package using the command:
The software-properties-common contain the tools that are used to add, manage, and remove the PPA repositories to Ubuntu.
Conclusion
To install packages from the PPA repository we use the command of the add-apt-repository. This command can add or remove the repositories in Ubuntu. In this write-up, usage of the add-apt-repository command has been explained with different examples of adding and removing the PPA repository.