apt-get无法找到安装包解决方法--添加源

2023-05-16

When you try to install a package using apt-get, APT searches it’s own database for the package name, if the package is available in the database, then it looks for the repository from where to download the package. It then download the package from that repository and installs it.

If the package name does not exist in APT’s database, it does not have any idea what you are trying to install andyou see the following error message:


#  apt-get install <packagename> Reading package lists... Done Building dependency tree... Done Package aptitude is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package <packagename> has no installation candidate  

 

So, the above error occurs for 2 reasons:

1) The APT’s database is not updated.

A quick fix is to update the APT’s database as per the defined sources list.


# apt-get update # apt-get upgrade # apt-get install <packagename>  

This is it. If isn’t fixed, check point #2 below.

2) The package itself isn’t available on the official Ubuntu repository.

In such a situation, you have to add a 3rd party repository to your /etc/apt/sources.list file and install the package, however, try such repositories at your own risk.

当我们在使用ubuntu命令窗,输入安装命令的时候,有些安装包总是提示


E: Package <packagename> has no installation candidate错误,于是便开始google,寻找原因。但苦苦追寻,能查到的都是
一些叫我们输入指令的语句 如sudo apt-get update等之类的命令,但该命令不管用。这是因为在我们的/etc/apt/sources.list
文件下,拥有的是只是一些系统初装的源,后期的一些源还是得自己添加的,不然网上的很多资源包都是无法使用的。下面我就贴上
我在网站上找到的各种源。

sources.list(源)

位置:/etc/apt/sources.list

常见的源:

1 中国科技大学源

deb http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe

2 北京交大源

deb http://mirror.bjtu.edu.cn/Ubuntu/ hardy main restricted universe multiverse
deb http://mirror.bjtu.edu.cn/Ubuntu/ hardy-backports restricted universe multiverse
deb http://mirror.bjtu.edu.cn/Ubuntu/ hardy-proposed main restricted universe multiverse
deb http://mirror.bjtu.edu.cn/Ubuntu/ hardy-security main restricted universe multiverse
deb http://mirror.bjtu.edu.cn/Ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy main restricted universe multiverse
deb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy-proposed main restricted universe multiverse
deb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy-security main restricted universe multiverse
deb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy-updates main restricted universe multiverse

3 台湾大学源

deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main restricted universe multiverse

4 CN99源

deb http://Ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
deb http://Ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
deb http://Ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
deb http://Ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb http://Ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://Ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
deb-src http://Ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://Ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://Ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb-src http://Ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse

5 Lupaworld源

deb http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse

(注释:deb代表的是我们需要的deb软件包,deb-src 是指下载源代码得指示。之后是包的来源地址,再在后面是系统的标记。之后的main代表的是主要软件包,universe是不被官方支持的自由软件。)

                                         如何更改源呢?


1、首先备份Ubuntu 8.04 的当前更新源列表(以备不测)

      sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup (备份下当前的源列表)


2、修改更新源
     sudo gedit /etc/apt/sources.list
3在里面我选择在后面添加源;

4、通知Ubuntu 11.10 启用新的更新源
     sudo apt-get update

我的终端命令如图:

root@ubuntu:~# sudo apt-get update


本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

apt-get无法找到安装包解决方法--添加源 的相关文章

  • GET 或 POST 哪个比另一个更安全?

    当比较 HTTP GET 和 HTTP POST 时 从安全角度来看有什么区别 其中一种选择本质上比另一种更安全吗 如果是这样 为什么 我意识到 POST 不会公开 URL 上的信息 但是这有什么真正的价值 还是只是通过模糊来实现安全 当考
  • Angular2 错误处理最佳实践

    我有一个关于 Angular2 错误处理最佳实践的问题 这是我用来捕获错误的代码 Getdata data object let body JSON stringify data let headers new Headers Conten
  • 如何在参数 $_GET 中使用变量?示例:($_GET[$my_var])

    我正在开发一个WordPress插件 GET的参数根据用户的偏好通过Wordpress管理面板记录在数据库中 以下验证必须通过 GET 进行 这是函数 db url get option my get url returns the val
  • 具有大量输入数据的 REST 端点 (GET)

    我正在开发一个应用程序 我需要将对象列表传递到 REST 端点 该端点将执行一些计算并将结果返回给调用者 问题更多的是一个哲学问题 即如何处理这种情况 在 GET 请求中传递巨大的负载是一个坏主意 同时 它并不是真正的 POST PUT 请
  • 使用 PHP 从

    我想获取里面的文字
  • 我可以 POST 和 GET 到同一个 PHP 页面吗

    例如 我想知道是否可以在同一个 php 页面上进行 GET 和 POST 我想将数据发送到 http www example com my php 所以首先是 GET http www example com my php task dos
  • Servlet和路径参数如/xyz/{value}/test,如何在web.xml中映射?

    servlet是否支持url如下 xyz value test 其中值可以用文本或数字替换 如何在 web xml 中映射它 最好的选择是 URL 模式 xyz The 服务程序接口 https jakarta ee specificati
  • REST Web 服务 - 动态查询参数

    我需要将动态查询参数发送到 REST Web 服务 GET 方法 如下所示 主机 端口 应用程序 field1 XXX value1 VVV field2 XXX value2 XXX 消费者可以发送参数最多为字段和值 每个字段都映射到值
  • 未捕获的类型错误:未定义不是 indexOf 上的函数

    我目前有此代码来检查特定 ID 的网站 URL GET 选项 但每当运行此代码时 我都会收到一个奇怪的错误 Uncaught TypeError Undefined is not a function 这是我的代码 如果我能得到关于这个问题
  • 第301章

    Problem 访客打开网址website com i 133r534 213213 12312312但此网址不再有效 需要将其转发到website com 视频 133r534 213213 12312312 我尝试过的 在过去的几个小时
  • iOS 安全性将带有密码的数据发送至服务器或从服务器发送数据

    我正在构建一个应用程序 需要在服务器执行任何操作之前从用户设备发送密码以在服务器上进行身份验证 事情是这样的 用户的手机上有一个纯文本密码 该密码也在服务器中以 bcrypt 二进制文件的形式存在 用户想要从数据库中获取某些内容 因此用户通
  • 是否可以在ajax get请求中获取页面的一部分?

    我知道我们可以在向服务器发出 GET 请求时获取整个页面 但是如果我只对该页面上的一个特定 div 感兴趣 或者更准确地说对其内容感兴趣 该怎么办 这里唯一的选择是获取整个页面 例如使用 jquery find 从中获取 div 内容吗 或
  • Swift:转义闭包捕获非转义参数“onCompletion”

    我的 swift 有问题 我正在尝试发送 API 请求 然后检索数据 但收到以下错误消息 Swift 转义闭包捕获非转义参数 onCompletion 有谁知道我该如何解决这个问题 提前致谢 Code class RestApiManage
  • 尝试使用curl进行GET,发送的值允许为空

    我正在尝试使用curl 来执行一个简单的GET 其中包含一个名为redirect uri 的参数 被调用的 php 文件打印出 GET redirect uri 的空字符串 它显示 red 并且似乎没有发送任何内容 执行获取操作的代码 Ge
  • 无法在 mysql-apt-config [Ubuntu 14.04] 中选择“确定”

    我使用的是 Ubuntu 14 04 sudo apt get update总是给我这个选项来配置 mysql apt config 我尝试选择版本 按 tab gt 在 确定 上突出显示的键 按 Enter 但没有任何反应 它再次返回并突
  • 获取couchdb数据库中所有文档的文档id

    我有一个简单的问题 我应该如何从 couchdb 中的给定数据库中检索所有文档的文档 ID 我编写了这段代码来检索所有文档 docs CouchRest get http localhost 5984 competency1 all doc
  • 使用 jQuery 将值发送到 $_GET

    我正在使用一个 PHP 脚本 该脚本正在通过 GET 等待两个值 我正在尝试使用 jQuery 传递这两个值 而这正是我不太擅长的地方 这是我得到的代码 有人能指出我正确的方向吗 谢谢 function xrate id rating aj
  • Memcached的get和put方法是线程安全的吗

    多线程环境下memcached中的key是否有可能出现乱码 如果是这样 如何以最短的同步时间避免它 使用Java客户端访问memcached服务器 不会 Memcache 将返回某人之前写入的值 而不是乱码 如果您获取 修改 放置 则无法保
  • 获取和编辑 GET 变量以创建超链接的方法

    假设我有这样的网址somefile php sort id way desc 我想编写一个函数 或使用已经创建的函数 让我将下一个变量添加到 URL 并设置我要删除的变量 我想到了类似的事情function editGetVar add l
  • php curl 使用 GET 发送变量 奇怪的结果

    我正在尝试调用远程站点上页面中的网址 决定使用curl 在远程站点上 url 变量显示为 REQUEST Array var1 gt val1 amp var2 gt val2 amp var3 gt val3 被调用的url是 http

随机推荐