无法使用 apt-get 安装文件:“无法定位包”

Ben*_*ing 61 apt

我在 HP550 笔记本电脑上安装的 ubuntu 服务器版本 12.04 有问题,当我尝试时sudo apt-get install <programname>,例如apache2它不会工作,说E: Unable to locate package apache2

我试图查看/编辑来源。但是它们将不起作用,或者gedit命令也被破坏了,我正在gedit /etc/apt/sources.list为那些想知道的人尝试,这是计算机网络配置不正确的情况吗?不过,它在安装中很容易下载了一个语言包。我该如何解决?及时答复将不胜感激。

jac*_*rdy 94

sudo apt-get update在尝试安装软件包之前尝试运行。安装后系统没有最新的软件包列表,因此您将无法找到该软件包。

完成此操作后,您应该可以正常安装。

  • docker debian:jessie 文件有这个问题。在尝试安装任何东西之前,您需要设置“RUN apt-get update”。 (4认同)

ear*_*Lon 16

检查您的 /etc/apt/sources.list

这是一个示例sources.list 文件。我使用程序net-select-apt为我选择了最快的镜像。另外,请注意这是针对12.04/Precise 的

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirror.symnds.com/ubuntu/ precise main restricted
deb-src http://mirror.symnds.com/ubuntu/ precise main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirror.symnds.com/ubuntu/ precise-updates main restricted
deb-src http://mirror.symnds.com/ubuntu/ precise-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirror.symnds.com/ubuntu/ precise universe
deb-src http://mirror.symnds.com/ubuntu/ precise universe
deb http://mirror.symnds.com/ubuntu/ precise-updates universe
deb-src http://mirror.symnds.com/ubuntu/ precise-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirror.symnds.com/ubuntu/ precise multiverse
deb-src http://mirror.symnds.com/ubuntu/ precise multiverse
deb http://mirror.symnds.com/ubuntu/ precise-updates multiverse
deb-src http://mirror.symnds.com/ubuntu/ precise-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirror.symnds.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirror.symnds.com/ubuntu/ precise-backports main restricted universe multiverse

deb http://mirror.symnds.com/ubuntu/ precise-security main restricted
deb-src http://mirror.symnds.com/ubuntu/ precise-security main restricted
deb http://mirror.symnds.com/ubuntu/ precise-security universe
deb-src http://mirror.symnds.com/ubuntu/ precise-security universe
deb http://mirror.symnds.com/ubuntu/ precise-security multiverse
deb-src http://mirror.symnds.com/ubuntu/ precise-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu precise partner
deb-src http://archive.canonical.com/ubuntu precise partner

## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main
Run Code Online (Sandbox Code Playgroud)

更新你的 apt

sudo apt-get update

检查apt是否可以找到apache2

sudo apt-cache search apache2

安装apache2

sudo apt-get install apache2

可选的附加存储库

这里有一些可选的存储库,您可以继续添加到sources.list的底部。

#Chromium
deb http://ppa.launchpad.net/chromium-daily/stable/ubuntu precise main
deb-src http://ppa.launchpad.net/chromium-daily/stable/ubuntu precise main
Run Code Online (Sandbox Code Playgroud)


小智 0

我也遇到过这个问题。我被告知我需要下载程序依赖项或“包”,然后才能在 Ubuntu 上安装该程序。你可以sudo apt-get update先尝试一下。

我认为 Apache 是第三方供应商,因此这就是 Ubuntu 找不到该软件包的原因。尝试访问 Apache 站点本身,查找可以下载并使用 Ubuntu 打开的适用于 Ubuntu 或 Linux 的软件包。然后尝试sudo apt-get install <program>

希望这可以帮助。

  • Apache2 是 apache 基金会的开源 http 服务器“httpd”的软件包名称。它肯定在存储库中。 (2认同)