FUNDAMENTALS A Complete Guide for Beginners
The add-apt-repository, a command-line script, is probably the most essential entity coming with the APT (Advanced Package Tool) package manager for repository configuration in Debian-based Linux distros such as Ubuntu. However, users often encounter an issue of not finding it at the right time in the terminal. So, in this article, I will shed light on the gist of this problem and provide tactics for a successful resolution to fix the add-apt-repository command not found error in Ubuntu.
Process Flow Chart to Fix “add-apt-repository” Command Not Found Error
[Distro Used Throughout the Tutorial: Ubuntu 22.04]
Understanding the “add-apt-repository” Command Not Found Error
As mentioned earlier, The add-apt-repsository command leverages the APT package management tool for ensuring the users a smooth software experience irrespective of being official or third-party. Nevertheless, in utilizing the command for package configuration, one may come across the complexity as follows. In the above snapshot, you notice when I run the command for listing the available system repositories, I am thrown the error message “Command ‘add-apt-repository’ not found”.
Don’t let yourself get worried. In the next few sections, I will discuss the possible causes along with mentioning a few effective ways for the solution.
2 Methods to Fix the”add-apt-repository” Command not found error
The solutions to the aforestated issue are pretty straightforward demanding just a few steps. In this feature, I will dive into 2 methods for resolving the error intricacies (using CLI and GUI). So, without further ado, let’s jump right in.
Method 01: Using CLI to Fix the “add-apt-repository” Command Not Found Error
One possible cause of the error is the absence of the add-apt-repository command in the system. On top of that, the command is included in the Software Properties Common package enabling users to add/remove repositories. Hence, installing the software properties common package to the system automatically lets you use the command for further goal attainment. And the process is also effortless like below:
- Open your Ubuntu Terminal by pressing CTRL+ALT+T.
- Now, type the below command and hit ENTER for package index updation:
sudo apt update
EXPLANATION- sudo: Grants root privileges.
- apt: The package management tool.
- update: Action updating the system repository index.
Here, my system repository cache is going through an updation. Updating is recommended before making any changes in the system. It allows for the containing of all the updated information about packages and their versions.
- After that, type the following command and press the ENTER button:
sudo apt-get install software-properties-common
EXPLANATION- sudo: Grants root privileges.
- apt-get: The package management tool.
- install: Argument specifying apt to install a package.
- software-properties-common: Name of the package to be installed.
Here, the image displays that I am installing the software-properties-common package.
Note: The command sudo apt install software-properties-common serves the same purpose. - Again, Run the below-mentioned command to update the system:
sudo apt update
After the updation, as shown above, I will now get the advantage of using the add-apt-repository command.
- At this point, Type this command and press ENTER:
add-apt-repository --list
EXPLANATION- add-apt-repository: the command for repository adding/removing.
- –list: Returns the repository log.
In the snapshot, you can see that the terminal throws no error. Thus, I installed the package and got access to the command with success.
Method 02: Using GUI to Fix the “add-apt-repository” Command Not Found Error
The Graphical User Interface (GUI) provides you with the opportunity to solve the issue quickly and simply like the following:
- Go to Software & Updates from the applications menu.
- Now, navigate to the Other Software tab and click on Add.
- After that, supply a repository URL in the APT line section and click Add Source.
For instance, In the above snap, you spot that I have added a repository URL named deb http://archive.getdeb.net/ubuntu wiley-getdeb games to the source APT line.
- At this point, provide the user password for authentication and click on Authenticate.
Well, this creates a new repository for the system via GUI. Furthermore, the addition also automatically resolves the problem by adding the apt-add-repository command. Finally, utilize the below-mentioned command for verification in the terminal.
apt-add-repository --list
Thus, you see that my system did not have the command earlier and threw an error at the time of use. However, after adding a new repository to the system through GUI, I can seamlessly use the command.
Comparison of 2 Methods to Solve “add-apt-repository” Command Not Found
As of now, I have introduced you to 2 effective methods for getting access to the apt-add-repository command for repository management. In this scope, I will feature some advantages and disadvantages of both methods.
Methods | Pros | Cons |
---|---|---|
Method 1 |
|
|
Method 2 |
|
|
Last but not least, whether you adopt a particular approach is left to your personal preference. For example, if you are comfortable using the command line, then the first method is for you. However, you can exercise the use of the latter method to easily fix the error if you are a Linux newbie or have a predilection for visual representation.
Conclusion
In this article, I have contributed to the in-depth analysis of the complexity that may arise when the add-apt-repository command is not found. Additionally, I explained illustrations for a comprehensive view of the issue and its resolution. Henceforth, from now on, you are capable of tackling any overwhelming situation regarding this, continuing your learning of Linux repository management, and establishing yourself as an advanced Linux practitioner without any hindrance.
People Also Ask
How do I manually add an APT repository?
You can manually add a new apt repository by providing the repo url in the main file sources.list located in the directory /etc/apt/sources.list.d/. You can also create a new file with .list extension in that same folder and avail repository handling.
What is apt add repository?
The apt-add-repository is a command line utility script that is responsible for the addition and uninstallation of repositories in Debian-based Linux distros such as Ubuntu.
How to install a program with apt-get?
By running the simple command sudo apt-get install <package_name>, you can install your desired software program. Remember <package_name> is the exact name of the package you want to install and multiple packages can be configured at once by separating their names with space.
Is APT recommended for beginner users?
For most users, especially newbies, the apt package management tool is highly recommended as it is very user-friendly and has an updated command structure than the apt-get. However, you have to have the sudo/root privilege for the successful use of apt.
Related Articles
- How to Remove APT Repositories in Linux[2 Easy Methods]
- The Universe Repository in Ubuntu [Enable, Install, Disable]
- The Repository Mirror in Ubuntu [An Extensive Overview]
- How to Add Repository in Ubuntu? [2 Simple Methods]
- How to Update Repository List in Ubuntu[3 Cases]
- How to add an APT Repository Proxy in Ubuntu [Easiest Guide]
<< Go Back to Repository Configuration in Linux | Package Management in Linux | Learn Linux Basics