欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

Ubuntu 20.04换阿里源的方法

程序员文章站 2022-03-19 16:36:39
注意,这篇文章其实不是简单的教你怎么换成20.04的源,而是教你一种基于20.04的方法来换源。笔者在写这篇文章的时候,20.04 还没有release出来正式版,但是已经可以在仓库里看到有源存在了,...

注意,这篇文章其实不是简单的教你怎么换成20.04的源,而是教你一种基于20.04的方法来换源。
笔者在写这篇文章的时候,20.04 还没有release出来正式版,但是已经可以在仓库里看到有源存在了,故写下这篇文章。

请注意:ubuntu 20.04 已于4月23日发布正式版本。
请注意:发现有些软件比如ckermit,仓库里还没有,升级及换源自行斟酌。

1 备份原来的源

cp -ra /etc/apt/sources.list /etc/apt/sources.list.bak

2 搞清楚ubuntu的代号,比如:

4.10warty warthog(长疣的疣猪)
5.04hoary hedgehog(灰白的刺猬)
5.10breezy badger(活泼的獾)

6.06(lts)dapper drake(整洁的公鸭)
6.10edgy eft(急躁的水蜥)
7.04feisty fawn(坏脾气的小鹿)
7.10gutsy gibbon(勇敢的长臂猿)

8.04(lts)hardy heron(耐寒的苍鹭)
8.10intrepid ibex (勇敢的野山羊)
9.04jaunty jackalope(得意洋洋的怀俄明野兔)
9.10karmic koala(幸运的考拉)

10.04(lts)lucid lynx(清醒的猞猁)
10.10oneiric ocelot(梦幻的豹猫)
11.04natty narwhal(敏捷的独角鲸)
11.10oneiric ocelot(有梦的虎猫)

12.04(lts)precise pangolin(精准的穿山甲)
12.10quantal quetzal(量子的绿咬鹃)
13.04raring ringtail(铆足了劲的猫熊)
13.10saucy salamander(活泼的蝾螈)

14.04(lts)trusty tahr (可靠的塔尔羊)(lts)
14.10utopic unicorn(乌托邦独角兽)
15.04vivid vervet (活泼的小猴)
15.10wily werewolf (狡猾的狼人)

16.04(lts)xenial xerus (好客的非洲地松鼠)
16.10yakkety yak(牦牛)
17.04zesty zapus(开心的跳鼠)
17.10artful aardvark(机灵的土豚)

18.04(lts)bionic beaver(仿生海狸)
18.10cosmic cuttlefish(宇宙墨鱼)
19.04disco dingo(舞动的灵犬)
19.10eoan ermine(白貂)

20.04(lts)focal fossa(专注的马达加斯加长尾狸猫)

要知道当前系统的代号,可以用以下命令:

lsb_release -a

Ubuntu 20.04换阿里源的方法

3 到阿里源看下这个源存在不存在


Ubuntu 20.04换阿里源的方法
可以看到,现在已经有了ubuntu 20.04(代号focal)的源。

4 然后以下面的为模板,把'todo'的地方换成上面的codename

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

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

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

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

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

比如我换好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

然后粘贴到刚才的/etc/apt/sources.list里。

5 更新缓存和升级

sudo apt-get update
sudo apt-get upgrade

到此这篇关于ubuntu 20.04换阿里源的方法的文章就介绍到这了,更多相关ubuntu 20.04换阿里源内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!