【轉】ubuntu 11.04使用apt-get安裝軟件時一直提示E:unable to locate package


問題:

VMware虛擬機安裝了ubuntu 11.04,在使用apt-get安裝軟件時一直提示E:Unable to locate package。
百度了原因,說是要更新源,使用命令:sudo apt-get update更新了,但更新之后問題還是存在;

安裝,unable,11.04,apt-get,軟件0

解決方案:

主要還是源的問題,目前網上找的很多源都是很久以前的了,很多的可能都不能用了; 然后自己重新下載了一個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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM