问题
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 broken links to this package. I am using Putty on a windows machine if that information helps.
I currently have low to none experience in linux enviroments.
I am running the following version of Linux
Linux ip-172-31-37-96 3.14.48-33.39.amzn1.x86_64 #1 SMP Tue Jul 14 23:43:07 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Can anyone help with that?
回答1:
If you're using Amazon Linux it's CentOS-based, which is RedHat-based. RH-based installs use yum not apt-get. Something like yum search httpd should show you the available Apache packages - you likely want yum install httpd24.
Note: Amazon Linux 2 has diverged from CentOS since the writing of this answer, but still uses
yum.
回答2:
Try to install your application by using yum command
yum install application_name
回答3:
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.debfor ubuntu xenial)Download the apt.deb
wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.4_amd64.debInstall the apt.deb package
sudo dpkg -i apt_1.4_amd64.deb
Now we can easily run
sudo apt-get install htop
回答4:
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.
回答5:
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
回答6:
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).
回答7:
You need to manually download the apt deb package. Then run dpkg and it should install.
来源:https://stackoverflow.com/questions/32592956/apt-get-command-not-found