当出现上述问题时
首先更新系统软件源
sudo apt-get update
sudo apt-get grade
接着再装试一试
sudo apt-get install
如果还不行就要更新软件源

  • Ubuntu 更新软件源的方法

1、打开终端;
2、输入命令备份原有软件源文件;
3、打开sources.list文件并添加新的软件源地址;
4、输入命令更新系统软件源地址。

  • 具体步骤

具体步骤如下:
1、使用快捷键【ctrl+alt+t】打开终端。
2、输入以下命令备份原有软件源文件。
cp /etc/apt/sources.list /etc/apt/sources.list.bak_yyyymmdd
3、再输入以下命令打开sources.list文件并添加新的软件源地址。
vim /etc/apt/sources.list #打开sources.list文件

PS: 新安装的Ubuntu可能没有安装Vim, 用如下命令先安装Vim:
sudo apt-get install vim-gtk

在文件末尾添加新的软件源地址,常用国内源地址如下:

#阿里源地址

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

#华为源地址

deb https://repo.huaweicloud.com/ubuntu/ focal main restricted
deb https://repo.huaweicloud.com/ubuntu/ focal-updates main restricted
deb https://repo.huaweicloud.com/ubuntu/ focal universe
deb https://repo.huaweicloud.com/ubuntu/ focal-updates universe
deb https://repo.huaweicloud.com/ubuntu/ focal-backports main restricted universe
deb https://repo.huaweicloud.com/ubuntu/ focal-security main restricted
deb https://repo.huaweicloud.com/ubuntu/ focal-security universe

#中科大源地址

deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

#163源地址

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

#清华源地址

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe ultiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe ultiverse

  • apt工作原理

每当执行命令进行软件的安装或着更新,或者软件源的更新时,apt会访问/etc/apt/sources.list内的地址,并在该网站中找到对应系统的包信息例如我的操作系统是ubuntu,网站是deb http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse网易的,那么当我们执行安装的命令时,他就会对应的访问http://mirrors.163.com/ubuntu/dists/lucid/main/binary-i386/的packages.gz,这个文件是服务器上软件包及其依赖关系的清单,并且用gzip压缩过了。apt-get update使用这个清单来确定能够获得哪些补充的软件包且他的内容会被保存在/var/lib/apt/lists内,通过访问这个lists确定该软件是否已安装,是否是最新版本,依赖关系是否满足,从而确定要更新内容,并进行更新,其安装过程主要是由dpkg来完成。

总体上来说apt是倾向于下载的一个管理工具

ubuntu进行apt-get时候出现Package xxx is not available, but is referred to by another package 错误相关推荐

  1. Package xxx is not available, but is referred to by another package

    这个问题的原因是ubuntu的/etc/apt/source.list中的源比较旧了,需要更新一下, 更新源之后,再更新: sudo apt-get -y update Ps:参考第二个链接修改/et ...

  2. ubuntu进行apt-get时候出现Package ssh is not available, but is referred to by another package 错误...

    今天在ubuntu进行ssh安装的时候,出现如下错误. Reading package lists... Done Building dependency tree... Done Package s ...

  3. Package vim is not available, but is referred to by another package.

    在使用虚拟机安装好UBUNTU  后,启动终端,输入sudo apt-get install vim 却出现下面到错误, Package vim is not available, but is re ...

  4. 报错package xxx is not in GOROOT or GOPATH 或者 cannot find package “xxx“ in any of

    动态演示图见 博客 GO111MODULE="off" 在GO111MODULE="off"的条件下,并且写的代码不在$GOPATH/src下,也就是说下面的m ...

  5. 【收藏】goland报错:报错package xxx is not in GOROOT or GOPATH 或者 cannot find package “xxx“ in any of

    其实,通过go run main.go命令也可以正常运行 https://blog.csdn.net/weixin_44676081/article/details/107279746

  6. ubuntu常见问题:E: Package ‘xxx‘ has no installation candidate 解决方法

    提示:ubuntu常见问题系列(学习使用) E: Package 'xxx' has no installation candidate 解决方法 出现了Package has no installa ...

  7. Ubuntu常用APT命令参数

    常用APT命令参数 apt-cache search package 搜索包 apt-cache show package 获取包的相关信息,如说明.大小.版本等 sudo apt-get insta ...

  8. Ubuntu使用apt管理安装软件包

    一.apt简介         apt 是 Advanced Packaging Tool 的简称,是一款安装包管理工具.在 Ubuntu 下,我们可以使用 apt 命令可用于软件包的安装.删除.清理 ...

  9. ubuntu 更新 apt 源

    参考:https://mirrors.cnnic.cn/help/ubuntu/ sudo sed -i "s@http://.*archive.ubuntu.com@https://mir ...

  10. ubuntu的APT介绍

    介绍: apt是一款安装包管理工具,在ubuntu下可以使用apt命令进行软件包的安装.删除.清理等 ubuntu软件操作的相关命令 *sudo apt-get update 更新源 *sudo ap ...

最新文章

  1. 在线作图|如何绘制一张变量相关图(PCA)
  2. 【bzoj1086】 scoi2005—王室联邦
  3. 享学金三银四一线大厂面试专题学习笔记
  4. java中sc的快捷键,Windows下的SC命令参考
  5. MySQL-常用引擎
  6. Phinecos(洞庭散人) 专注于开源技术的研究与应用 TinyXML:一个优秀的C++ XML解析器
  7. 【Clickhosue】MySQL 没有主键导致CK不可用 The db.scene cannot be materialized, because there is no primary keys
  8. node-webkit浏览器插件注册升级方式
  9. 字符HTML编码类(转)
  10. linux命令从哪里敲,Linux 笔记本基于“敲打”的命令
  11. 学JAVA需要学数据结构吗?选择哪版数据结构教程合适?
  12. 树莓派 linux 私有云,树莓派搭建私有云服务器
  13. 【产品经理】 产品进阶之路(二):如何为失明的人设计一款钟表
  14. 【Akka】Akka并发编程设计
  15. Nginx:正向代理与反向代理
  16. golang力扣leetcode 2245.转角路径的乘积中最多能有几个尾随零
  17. 【Vue】快乐学习第二篇
  18. 计算机的收获初一作文,写收获的初一作文五篇
  19. julia常用矩阵函数_Julia语言中矩阵常用操作
  20. 传统 Web 框架部署与迁移

热门文章

  1. 大学计算机excel高级筛选,excel高级筛选的使用方法(入门 进阶 高级)
  2. BIO、NIO、AIO网络编程
  3. hardfault常见原因_应对STM32 Cortex-M3 Hard Fault异常
  4. 【XXE技巧拓展】————8、黑夜的猎杀-盲打XXE
  5. Codeforces Round 444 div2 D Ratings and Reality Shows (双指针)
  6. 论文笔记(三):DAML: Dual Attention Mutual Learning between Ratings and Reviews for Item Recommendation
  7. JAVA-数据类型与运算符笔记
  8. jquery 源码分析系列1
  9. 科技云报道:率先迈入“10微秒”时代,腾讯云存储跑出加速度
  10. 如何设计SaaS商业模式