找不到apt-get:命令

时间:2015-09-15 18:17:03

标签: linux apt

我试图在我的AWS实例上安装apache服务器,但是,它似乎没有安装apt软件包。

我用谷歌搜索,我发现的是这个包裹的一些断链。如果这些信息有帮助,我在Windows机器上使用Putty。

我目前在linux环境中缺乏经验。

我正在运行以下版本的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

任何人都可以帮忙吗?

12 个答案:

答案 0 :(得分:180)

如果你使用的是亚马逊Linux,它基于CentOS,基于RedHat。基于RH的安装使用yum而非apt-get。像yum search httpd这样的东西应该显示可用的Apache包 - 你可能想要yum install httpd24

  

注意:自撰写此答案以来,Amazon Linux 2已diverged from CentOS,但仍使用yum

答案 1 :(得分:11)

尝试使用yum命令安装您的应用程序 yum install application_name

答案 2 :(得分:4)

我遇到了与apt-get: command not found相同的问题,以下是我在ubuntu xenial上解决问题的步骤

  • here搜索相应版本的 apt apt_1.4_amd64.deb表示ubuntu xenial)

  • 下载apt.deb

    wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.4_amd64.deb

  • 安装apt.deb软件包

    sudo dpkg -i apt_1.4_amd64.deb

现在我们可以轻松运行

sudo apt-get install htop

答案 3 :(得分:2)

检查Linux发行版,apt-get适用于Debian based distro,而yum适用于Fedora based distro

Ref: How to know distro name,执行命令cat /etc/*-release

您的系统管理员也可能不允许您(或者没有让您拥有sudo权限的用户组)执行apt-get但是如果您sudo如果您使用sudo apt-get <package_name>,请尝试使用debian yum install <package_name>Fedora执行。

答案 4 :(得分:1)

  

apt–get:找不到命令

对于基于Debian的Linux发行版:

尝试使用sudo apt install <package>代替通常的sudo apt-get install <package>

来自man apt

  

apt为程序包管理系统提供了高级命令行界面。与更专门的APT工具(如apt-get(8)和apt-cache(8))相比,它旨在用作最终用户界面,并默认启用一些更适合交互式使用的选项。

答案 5 :(得分:1)

此答案适用于完整的AWS初学者:

我遇到了这个问题,但这是因为我试图从Mac计算机中的教程中运行命令。我实际上需要做的是将SSH连接到我的AWS机器中,然后在其中运行相同的命令。塔达,它起作用了:

enter image description here

在您的EC2实例中单击此按钮,以便能够复制SSH命令。设置您的SSH密钥https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html,然后可以SSH进入您的计算机

在这里,您可以运行sudo apt-get命令。

希望这对其他初学者有帮助

答案 6 :(得分:1)

可能有2个问题:=

1. Your are trying the command in machine that does not support apt-get command
because apt-get is suitable for Linux based Ubuntu machines; for MAC, try
apt-get equivalent such as Brew

2. The other issue can be that your installation was not completed properly So

简短答案:

Re-install Ubuntu from a Live CD or USB.

长版:

The long version would be a waste of your time: your system will never
be clean, but if you insist you could try:

==> Copying everything (missing) except for the /home folder from the Live
CD/USB to your HDD.

OR

==> Do a re-install/repair over the broken system again with the Live
CD / USB stick.

OR

==> Download the deb file for apt-get and install as explained on above posts.
I would definitely go for a fresh new install as there are so many things to
do and so little time.

答案 7 :(得分:0)

对于openSUSE Linux发行版:

sudo zypper install <package>

例如:

sudo zypper install git

答案 8 :(得分:0)

Amazon Linux 2 AMI (HVM), SSD Volume Type 使用 yum 和 sudo

示例:尝试在 aws 实例上使用 apache 安装 wsgi

sudo yum install python3-pip apache2 libapache2-mod-wsgi-py3

答案 9 :(得分:0)

尝试运行

sudo amazon-linux-extras 安装 nginx1

Nginx 也可在 Amazon Linux extras 上使用

https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras

答案 10 :(得分:-1)

您需要手动下载apt deb软件包。然后运行dpkg,它应该安装。

答案 11 :(得分:-1)

这是您可以运行以安装apt-get的命令之一:

wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.4_amd64.deb

相关问题