问题:
VMware虚拟机安装了ubuntu 11.04,在使用apt-get安装软件时一直提示E:Unable to locate package。
百度了原因,说是要更新源,使用命令:sudo apt-get update更新了,但更新之后问题还是存在;
解决方案:
主要还是源的问题,目前网上找的很多源都是很久以前的了,很多的可能都不能用了; 然后自己重新下载了一个ubuntu 14.04版本的源替换原来的sources.list文件,然后运行sudo apt-get update更新后就可以安装软件了。
更新源地址(这是Ubuntu 14.04的/etc/apt/source.list文件的内容):
#deb cdrom:[Ubuntu 14.04 LTS _Trusty Tahr_ - Release amd64 (20140417)]/ trusty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-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://us.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-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://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-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://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-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 trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty 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 trusty main
deb-src http://extras.ubuntu.com/ubuntu trusty main
修改Ubuntu系统源的方法:
1、更源的保存文件的权限,在终端中执行下面的命令:
chmod 777 /etc/apt/sources.list
2、打开源文件
在终端中执行下面的命令:
gedit /etc/apt/sources.list
喜欢vi的朋友可以用下面的命令:
vi /etc/apt/sources.list
3、把上面给出的Ubuntu 14.04的源复制到sources.list文件中保存退出,其中以 # 号开头的表示注释,可以一起复制,不会出错。
4、在终端中执行下面的命令:
sudo apt-get update
5、关于添加源后Dynamic MMap ran out of room. Please increase the size of APT::Cache-Limit.*****错误的解决办法:
a、在终端中输入命令: vi apt.conf
b、然后加入如下内容 :
APT
{
Cache-Limit 67108864;
};
c、保存退出,再次apt-get update,问题应该就可以解决了,若是你添加的源更多,可能还会报错,那么可以再把67108864这个数值改大,
主要原因是默认的缓存不够,需要手动设置apt.conf 文件, 在这里设置了64mb
注:若是没有apt.conf,那么就需要新建apt.conf文件,新建文件之后再执行以上操作。
本文转自:
http://www.itnose.net/detail/6116378.html
http://jingyan.baidu.com/article/f54ae2fcc881881e93b84967.html