apt-get command is used to manage package in Ubuntu and other Debian based distribution. You can install, remove software in Ubuntu, You can update upgrade ubuntu and other operating systems with help of this command.
If you want to install new software on the Linux operating system by apt-get command but you get the error “apt-get command not found“. This is really the biggest problem for the new user. Neither you can install new packages nor you can update and upgrade ubuntu.
apt-get is not working, how will you install a new package? If the problem only of installing new packages then it can be solved. You can use dpkg command to install deb files in ubuntu and derivatives.
- Why do you get error “apt-get: command not found”?
- Resolve error apt-get: command not found
Why do you get error “apt-get: command not found”?
Your first task to check “why are you getting this error apt-get: command not found?” You have two options to rectify the problem
Check #1 Check running Operating System
the apt-get command only works on Ubuntu, Debian, and its derivatives. If you are running rpm based operating system like CentOS, RHEL, and Fedora etc, then this command will not work. And you will get an error about command not found.
CentOS and RHEL are using “yum” package manager to install, remove, packages and more.
if you are using RHEL and its derivatives then forget apt-get command and start using yum command.
Check #2: Check availability of apt-get package
If you are using a compatible operating system for apt-get then, please check this package is installed on your system or not.
You can use following command to check the installed package apt-get
vijay@Ubuntu19:~$locate apt-get /usr/bin/apt-get /usr/share/bash-completion/completions/apt-get /usr/share/bash-completion/completions/slapt-get /usr/share/man/de/man8/apt-get.8.gz /usr/share/man/fr/man8/apt-get.8.gz /usr/share/man/it/man8/apt-get.8.gz /usr/share/man/ja/man8/apt-get.8.gz /usr/share/man/man8/apt-get.8.gz /usr/share/man/nl/man8/apt-get.8.gz vijay@Ubuntu19:~$
If you will see the result as above it means the apt-get package installed, If you will get no output means. Your system don’t have apt-get package manager.
You can install by using the following instructions described in the next steps.
Solve error apt-get: command not found
you are getting error apt-get command not found because you don’t have installed the apt package on your ubuntu system So follow the steps to install apt package manager
Step 1: Download deb file of apt
You should download the latest package and compatible with your system architecture. If you are using 32bit operating system then download 32 bit .deb file. if your system is 64bit please download 64-bit package.
You should find the downloading source from the file /etc/apt/sources.list, For the example I am using ubuntu and the source list is http://security.ubuntu.com/ubuntu
If you are using another operating system then use following the command to find out the downloading source
Open the downloading source and go /pool/main/a/apt/, Here you can choose an appropriate version as per your system architecture.
See result in the following picture in mine case.
Step #2 Download the right executable file of apt
You can download through the browser or you can use wget command.
Get the source address of the file, and use wget command to download file
vijay@Ubuntu19:~$wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.9.3_amd64.deb --2019-09-06 09:38:43-- http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.9.3_amd64.deb Resolving security.ubuntu.com (security.ubuntu.com)... 18.104.22.168, 22.214.171.124, 126.96.36.199, ... Connecting to security.ubuntu.com (security.ubuntu.com)|188.8.131.52|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1279228 (1.2M) [application/x-debian-package] Saving to: ‘apt_1.9.3_amd64.deb’ apt_1.9.3_amd64.deb 100%[===================>] 1.22M 276KB/s in 5.2s 2019-09-06 09:38:49 (241 KB/s) - ‘apt_1.9.3_amd64.deb’ saved [1279228/1279228] vijay@Ubuntu19:~$
Step #2: install downloaded deb file in Ubuntu and derivatives
Once the downloading process has been completed, you can install it by using dpkg command.
The command is as following
$ sudo dpkg -i apt_1.9.3_amd64.deb
vijay@Ubuntu19:~$ sudo dpkg -i apt_1.9.3_amd64.deb
Once the apt package will install in your Linux system the apt-get command not found error will be resolved
If you have any question please in comment box.
Thanks for reading