I\'m trying to install an apache server on my AWS instance, however, it seems that it doesn\'t have the apt package installed.
I googled and all I found was some bro
You need to manually download the apt deb package. Then run dpkg and it should install.
I faced the same issue regarding apt-get: command not found
here are the steps how I resolved it on ubuntu xenial
Search the appropriate version of apt from here
(apt_1.4_amd64.deb
for ubuntu xenial)
Download the apt.deb
wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.4_amd64.deb
Install the apt.deb package
sudo dpkg -i apt_1.4_amd64.deb
Now we can easily run
sudo apt-get install htop
apt–get: command not found
For Debian based Linux distributions:
Try to use sudo apt install <package>
instead of the usual sudo apt-get install <package>
From man apt
apt provides a high-level commandline interface for the package management system. It is intended as an end user interface and enables some options better suited for interactive usage by default compared to more specialized APT tools like apt-get(8) and apt-cache(8).
Check the Linux distribution, apt-get
works in Debian based distro whereas yum
works in Fedora based distro.
Ref: How to know distro name, execute command cat /etc/*-release
It is also possible your system administrator does not permit you (or did not put you in the group of users who have sudo
permissions) to execute apt-get
but if you have sudo
access try to execute with sudo apt-get <package_name>
if debian
or yum install <package_name>
if you are using Fedora
.
This answer is for complete AWS beginners:
I had this issue but it was because I was trying to run a command from a tutorial inside my Mac computer. What I actually needed to do was SSH into my AWS machine, and then run the same command there. Ta Da, it worked:
Click this button in your EC2 instance, to be able to copy the SSH command. setup your SSH keys https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html and then you can SSH into your machine
Once here, you can run your sudo apt-get
command.
Hope this helps other beginners
This is one of the command which you can run to install apt-get:
wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.4_amd64.deb