Ubuntu 安裝源配置:Unable to locate package & unmet dependencies

【解決場景】:

1.無法找到軟件包

apt-get install : E: Unable to locate package xxx

軟件中心安裝時顯示:There isn't a software package called "Smile" in your current software resources

2.可以找到軟件包,但無法自動安裝依賴

The following packages have unmet dependencies:
 package1 : Depends: package2 (>= 1.8) but 1.7.5-1ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.

【解決方案】

以上問題都由源沒有添加 安裝源導致的。

源所在位置:/etc/opt/sources.list


安裝源模板:

deb MIRROR_URL/ubuntu/ UBUNTURELEASENAME main restricted universe multiverse
deb MIRROR_URL/ubuntu/ UBUNTURELEASENAME-security main restricted universe multiverse
deb MIRROR_URL/ubuntu/ UBUNTURELEASENAME-updates main restricted universe multiverse
deb MIRROR_URL/ubuntu/ UBUNTURELEASENAME-proposed main restricted universe multiverse
deb MIRROR_URL/ubuntu/ UBUNTURELEASENAME-backports main restricted universe multiverse
deb-src MIRROR_URL/ubuntu/ UBUNTURELEASENAME main restricted universe multiverse
deb-src MIRROR_URL/ubuntu/ UBUNTURELEASENAME-security main restricted universe multiverse
deb-src MIRROR_URL/ubuntu/ UBUNTURELEASENAME-updates main restricted universe multiverse
deb-src MIRROR_URL/ubuntu/ UBUNTURELEASENAME-proposed main restricted universe multiverse
deb-src MIRROR_URL/ubuntu/ UBUNTURELEASENAME-backports main restricted universe multiverse


國內鏡像地址:替換模板中的 MIRROR_URL

http://mirrors.sohu.com
http://mirrors.163.com
http://mirrors.aliyun.com
http://ubuntu.uestc.edu.cn

ubuntu版本名:替換UBUNTURELEASENAME, eg : xenial

lsb_release -a
root@ubuntu:/etc/apt# lsb_release -a
No LSB modules are available.
Distributor ID:Ubuntu
Description:Ubuntu 16.04 LTS
Release:16.04
Codename:<strong>xenial   #版本名</strong>



安裝源示例:

使用時只需要替換 trusty爲相應的ubuntu版本名,保存爲sources.list,並替換/etc/opt/sources.list即可,注意要使用root權限 sudo cp sources.list /etc/opt/sources.list

# /etc/apt/sources.list
# cn
deb http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse


deb http://ubuntu.uestc.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse

# office
deb http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
# beta
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
# src
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
# beta
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
# US
deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
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
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
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://archive.canonical.com/ubuntu trusty partner
deb-src http://archive.canonical.com/ubuntu trusty partner
deb http://us.archive.ubuntu.com/ubuntu/ trusty-security main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-security main restricted
deb http://us.archive.ubuntu.com/ubuntu/ trusty-security universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-security universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty-security multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-security multiverse



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章