无法使用apt-get安装文件:“无法找到包”

我在HP550笔记本电脑上安装了我的ubuntu服务器版本12.04时出现问题,当我尝试sudo apt-get install ,例如apache2它将无法工作,说E: Unable to locate package apache2

我试图查看/编辑源代码。 但他们也无法工作gedit命令也被破坏了,我正在尝试gedit /etc/apt/sources.list为那些想知道,这是计算机网络配置不正确吗? 它在安装中很容易下载了一个语言包。 我该如何解决? 我们将不胜感激。

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

一旦你完成了这个,你应该能够正常安装。

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

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

 # 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 ## NB 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 ## NB 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 ## NB 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 

更新你的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 

是的尝试编写sudo apt-get update这将下载源包列表。 apache2将在更新列表中

我也遇到过这个问题。 在我可以在Ubuntu上安装程序之前,我被告知需要下载程序依赖项或“软件包”。 您可以先尝试sudo apt-get update

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

希望这可以帮助。