Psychz - Sharad
Votes: 0Posted On: Apr 10, 2017 00:38:02
To troubleshoot any error pertaining to the “apt-get” command, you need to have a basic understanding of what the said command actually does. APT (Advanced Package Tools) is a set of tools for managing packages of Debian operating systems and its derivatives like Ubuntu. These packages consist of all the primary and auxiliary applications required for various functions.
apt-get command
A simple command line tool, the apt-get command performs the functions of installing, removing, updating and upgrading a package. The commands used for these functions are discussed in brief.
Installing a package : sudo apt-get install
Removing a package : sudo apt-get remove
Updating a package : sudo apt-get update
Upgrading a package : sudo apt-get upgrade
For information about the command : apt-get help
apt-get: command not found
-
Check your operating system
The APT packages are used in Debian operating systems and its derivatives. If you are getting the error message “apt-get : command not found ” please check the operating system you are working on. The “apt-get” will not work on RHEL and its derivatives like CentOS. These operating systems use the “yum” repository that contains all the software packages. To install packages in these operating systems, use the “yum” command.
Run the command:
locate apt-get
The following output should be displayed: /usr/bin/apt-get
If the command returns no output, then you have no “apt” package installed. You will have to install the apt package manually by accessing the “ /etc/apt/sources.list” file.
This file contains all the relevant links to install or upgrade packages. Choose the appropriate mirror from the list.
The mirror will look something like this:
In the mirror, go to the “/pool/main/a/apt/ ” directory and download the correct “.deb ” file suitable for your architecture.
You can install the file by running the following command:
sudo dpkg -i apt -xxx.deb
Here is a sample output of the “ /pool/main/a/apt/ ” directory.
If after running the command “locate apt-get” , no output is displayed, check the file “apt-get” in the directory /usr/bin/. If the directory “ /usr/bin ” is completely empty there is no option other than to reinstall the operating system.