The APT (Advanced Package Tools) is a package manager used to manage packages of operating systems based on Debian and its derivatives, such as Ubuntu. APT can be used to install, update the operating system and remove applications. When working with APT, a common error encountered is “apt-get command not found”.
This error occurs when you try to install other operating systems that do not support APT. Using the command with the appropriate operating systems will resolve the issue.
In this article, we will delve into the details of this error and its solutions.
What is the apt-get command?
The apt-get is a command-line tool used to install, update, and remove a Linux package. Gets information about authenticated font packages to install or remove, along with their dependencies.
The most common commands in apt-get are as follows:
sudo apt-get install (to install a package) sudo apt-get remove (to remove packages) sudo apt-get update (to update a package) sudo
- apt-get upgrade (to update a package)
- apt-get
- help (to learn more about a command)
Here, sudo is used to provide you with the security privileges of a superuser.
What is apt-get not found command?
As mentioned earlier, when you try to install or modify a package on Linux with the apt-get command, you might get this error. It can look something like this:
apt-get install httpd24
Let’s look at the reasons behind this problem
. The
apt-get command only works on Debian, Ubuntu and their derivatives. If you are trying to install rpm-based operating systems such as Fedora, RHEL, and CentOS, the command will not work. As a result, you will receive the error.
Distributions that support apt-get
- Debian
- Ubuntu
- Mint
- Kali
To find out the name of the Linux distribution, type the following command
: cat /etc/*-release
package
not available
If you are using an operating system that supports the apt-get command, check the availability of the APT. Type the locate apt-get command to check if it is installed on your system. The command should return the following
output: /usr/bin/apt-get
If no output is returned, the APT package is not installed. You have to install it manually to make things work for you.
How to solve apt-get command did not encounter an error?
This apt-get command
did not encounter error using the following method: Using the correct package manager Downloading the latest APT package Reinstalling the operating system 1) Using the correct package manager The first step in solving the problem is to use the correct Linux distributions with the apt-get
command.
Avoid attempting to download the ones that APT does not support, which are as follows:
CentOS
- openSUSE
- Arch
- macOS X
- Fedora
RHEL
Fedora Distributions such as
,
CentOS, and RHEL use Yum as their default package manager. Type the following command to install them using Yum –
$ sudo yum install <name>
macOS X uses Homebrew as its default package manager. You can use it by running the following command
– $ brew install tmux
For Arch Linux, you need to use the Pacman package manager like this – $ packman –
S tmux 2) Download the latest APT package Another way to resolve this error is to download
the latest APT package
that is compatible with your system. You should download the .deb file depending on your system architecture, which can be a 32-bit or 64-bit operating system.
Download the .deb file from the “/etc/apt/sources.list” file. Relevant links for installation and package updates are located within this file. You can query the download source by running the $cat /etc/apt/sources.list command.
In the download
source, visit the “/pool/main/a/apt/ directory”, locate the appropriate .deb file for your architecture and download it. After downloading, the file, install it using the command
dpkg – $ sudo dpkg -i apt_1.9.3_i386.deb
3) Reinstalling the operating system
After installing the APT package, check the /usr/bin/ directory to make sure it was installed correctly. If the file is empty, run the locate apt-get command again. If no results are displayed, there is no alternative but to reinstall the operating system. This might fix the problem.
Make sure that all commands are using the sudo access keyword correctly. The apt-get error can arise if the system administrator does not allow you to run the apt-get command on your system.