Ubuntu 代号引发的“崩溃”



写这篇文章主要是因为在前几天,因为向来不关心ubuntu代号的我而引发的一次“崩溃”(人崩溃),正如我们所知Ubuntu 每半年都会更新一个版本,每两年都会发布一个TLS(长期支持版本),具体每个版本以及代号我就不一一介绍了,网上资料一大堆。下面仅列举最近的三个长期版本:

版本号代号发布时间
16.04Xenial Xerus(好客的非洲地鼠)2016年4月(TLS)
18.04Bionio Beaver (仿生海狸)2018年4月(TLS)
20.04Focal Fossa (类似猫的食肉哺乳动物)2020年4月 (TLS)

我们看看Ubuntu起的代号还是蛮有意思的,一般都是某种动物且是按照英文排序的(ABCDE…)。那这个代号跟我要写这篇文件的目的有什么关系呢?往下看~

我们知道Linux操作系统下载和安装软件是需要配置源地址的(网络源、本地源)。我一般都是配置网络源(公司的、官网的、阿里、清华大学等)。下面简单看着ubuntu 源配置例子:

阿里源网站我们可以看到:

ubuntu 18.04的配置如下:

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

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

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

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src 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-backports main restricted universe multiverse

ubuntu 20.04的配置如下:

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

了解或细心的朋友能够看到,他们的区别很小就是 bionicfocal的区别。这个区别虽然很小,但是非常重要。如果配置不对,可能会像我一样遇到“崩溃”的问题。 bionicfocal 就是ubuntu 的代号(Codename)

我们来简单说下上面的内容都是啥意思,然后接着聊我遇到的什么“崩溃”事。

1)每行开头是deb 或 deb-src 指的是通过.deb 还是源文件方式安装软件;

2)http://mirrors.aliyun.com/ubuntu/ 这个大家一看就明白,是源下载地址;

3)bionic 或focal 以及以这两个字符串开头的都是和代号有关的;

4)main restricted universe multiverse 这些就是代号下面的几个目录

具体我们来看看2020的结构如下,进入地址 可以看到:
在这里插入图片描述
我们再点其中一个进去,如点击focal,界面如下:
在这里插入图片描述

正如我们看到的就是我们需要在sources.list文件中需要配置的(当前也可以写文件放到/etc/apt/sources.list.d目录下),如果少配置一个可能有的软件安装的时候就会找不到,所以尽量都配置上。


那我遇到的崩溃问题是啥呢?


其实就和这个代号有关,我安装了Ubuntu18.04版本,结果按照老的机器配置了16.04 的源地址。因为开发需要安装GTK 的开发包(即dev包),上来我就apt-get update ,apt-get install 等,但是都不让装,各种依赖。最后没有办法,就想着用源码安装,结果发现这个GTK 依赖了很多库,最后大概下了几十个源码编译安装,过程艰辛,差点崩溃。后来发现只要配对了正确的源,一个apt安装命令就搞定了,瞬间崩溃。所以我们在配置源之前,一定要清楚安装的ubuntu 的代号是什么。具体查看 ubuntu 代号的方法:执行 lsb_release -a
在这里插入图片描述
上面我们可以看到Ubuntu 16.04 的代号(Codename)是xeninal ,那么我们在配置源的时候一定要记住配置xenial 相关的。不过默认你安装的版本都是配置好的(路径/etc/apt/sources.list),只是一般都是官网的。由于是国外的网站,所以下载会比较慢,一般我们可以改成国内的镜像源或公司的。这个时候就要尤其注意这个“代号”了。

注:
     这个不光是对 Ubuntu 适用,对deepin、uos等debain系列的操作系统都使用,也就是在配置源之前一定要弄清楚当前版本对应的代号是什么。

好了,引起此次崩溃的主要原因还是我对Ubuntu sources.list内容的不理解,也算是学习了,在这里做个总结和分享。有什么不对的地方,望指正,祝您工作顺利,加油~
  • 13
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值