apt-get

来源:互联网 发布:通达信软件电脑版 编辑:程序博客网 时间:2024/05/01 07:46
E: Package 'package ' has no installation candidate的原因分析 /etc/apt/sources.list 2012-12-13 12:02:20| 分类: 技术TEC | 标签: |字号大中小 订阅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 and you see the following error message: # apt-get install 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 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 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 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 universedeb http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universedeb http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universedeb http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universedeb http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universedeb-src http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universedeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universedeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universedeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universedeb-src http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe2 北京交大源deb http://mirror.bjtu.edu.cn/Ubuntu/ hardy main restricted universe multiversedeb http://mirror.bjtu.edu.cn/Ubuntu/ hardy-backports restricted universe multiversedeb http://mirror.bjtu.edu.cn/Ubuntu/ hardy-proposed main restricted universe multiversedeb http://mirror.bjtu.edu.cn/Ubuntu/ hardy-security main restricted universe multiversedeb http://mirror.bjtu.edu.cn/Ubuntu/ hardy-updates main restricted universe multiversedeb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy main restricted universe multiversedeb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy-backports main restricted universe multiversedeb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy-proposed main restricted universe multiversedeb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy-security main restricted universe multiversedeb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy-updates main restricted universe multiverse3 台湾大学源deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiversedeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiversedeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiversedeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiversedeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiversedeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiversedeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiversedeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiversedeb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universedeb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main restricted universe multiverse4 CN99源deb http://Ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiversedeb http://Ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiversedeb http://Ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiversedeb http://Ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiversedeb http://Ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiversedeb-src http://Ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiversedeb-src http://Ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiversedeb-src http://Ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiversedeb-src http://Ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiversedeb-src http://Ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse5 Lupaworld源deb http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiversedeb http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiversedeb http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiversedeb http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiversedeb http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiversedeb-src http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiversedeb-src http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiversedeb-src http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiversedeb-src http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiversedeb-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
原创粉丝点击