前言

目前网上关于一些Ubuntu12.04/Ubuntu20.10/Ubuntu22.10更换阿里云源方案都不可以,是因为Ubuntu12.04/Ubuntu20.10/Ubuntu22.10都是Old Ubuntu Releases。
其官网主页:http://old-releases.ubuntu.com/releases/
因此其阿里云下载地址:https://mirrors.aliyun.com/oldubuntu-releases

The following old releases of Ubuntu are available:

Ubuntu 12.04.5 LTS (Precise Pangolin)
Ubuntu 20.10 (Groovy Gorilla)
Ubuntu 22.10 (Kinetic Kudu)

对于 14.04,16.04,18.04,20.04,22.04,24.04属于Ubuntu LTS,其换源比较简单。

一、Ubuntu LTS更换阿里云源

Ubuntu14.04,16.04,18.04,20.04,22.04,24.04属于Ubuntu LTS,Ubuntu 发行版的两种类型:Interim(临时)版本和 LTS 版本。每个 Ubuntu LTS 版本总共维护 10 年:5 年标准支持 + 5 年 ESM。Interim(临时)版本维护 9 个月。
请参考:https://releases.ubuntu.com/

Version numbers are YY.MM:
Ubuntu 的发行版有一个开发代号(“Mantic Minotaur”),版本按交付的年份和月份进行标记 - 例如,Ubuntu 23.10 是在 2023 年 10 月发布的。

LTS 或“长期支持”版本每两年在四月发布一次。LTS 版本是 Ubuntu 的“企业级”版本,被广泛使用。据估计,95% 的 Ubuntu 安装是 LTS 版本。

Ubuntu LTS 版本为“Main”存储库中的所有软件包提供 5 年标准安全维护。使用 Ubuntu Pro 订阅,您可以获得扩展的安全维护(ESM),覆盖“Main”和“Universe”存储库内软件包的安全修复,时长为 10 年。

Ubuntu LTS更换阿里云源比较简单:

cp /etc/apt/sources.list /etc/apt/sources.list.back
vim /etc/apt/sources.list

根据对应的版本填入对应的信息,请参考:https://developer.aliyun.com/mirror/ubuntu,比如22.04:

deb https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse
apt-get update

Ubuntu 中的软件包(debs)根据它们是否被视为基础系统的一部分进行分类(‘main’ 和 ‘restricted’ 属于基础系统,‘universe’ 和 ‘multiverse’ 不属于),以及它们是否开源(‘main’ 和 ‘universe’ 是开源的,‘restricted’ 和 ‘multiverse’ 不是)。

更多信息请参考:https://ubuntu.com/about/release-cycle

二、Ubuntu12.04更换阿里云源

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.4 LTS"

https://mirrors.aliyun.com/oldubuntu-releases/ubuntu/dists/找到precise:
在这里插入图片描述
Ubuntu12.02更换阿里云源:

cp /etc/apt/sources.list /etc/apt/sources.list.back
vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise main multiverse restricted universe
deb-src http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise main multiverse restricted universe

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

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

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

deb http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise-backports main multiverse restricted universe
apt-get update

三、Ubuntu20.10更换阿里云源

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.10
DISTRIB_CODENAME=groovy
DISTRIB_DESCRIPTION="Ubuntu 20.10"

目前网上关于一些Ubuntu20.10更换阿里云源的方案都不可以,网上的方案都是使用该网址:http://mirrors.aliyun.com/ubuntu/
而目前阿里云将Ubuntu20.10的阿里云源更换到了https://mirrors.aliyun.com/oldubuntu-releases/ubuntu/

官网主页:http://old-releases.ubuntu.com/releases/
下载地址:https://mirrors.aliyun.com/oldubuntu-releases

https://mirrors.aliyun.com/oldubuntu-releases/ubuntu/dists/查找 groovy 相关的目录:
在这里插入图片描述

Ubuntu20.10更换阿里云源:

cp /etc/apt/sources.list /etc/apt/sources.list.back
vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ groovy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ groovy main restricted universe multiverse

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

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

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

deb http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ groovy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ groovy-backports main restricted universe multiverse
apt update

四、Ubuntu22.10更换阿里云源

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.10
DISTRIB_CODENAME=kinetic
DISTRIB_DESCRIPTION="Ubuntu 22.10"

https://mirrors.aliyun.com/oldubuntu-releases/ubuntu/dists/查找 kinetic 相关的目录:

在这里插入图片描述

cp /etc/apt/sources.list /etc/apt/sources.list.back
vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ kinetic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ kinetic main restricted universe multiverse

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

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

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

deb http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ kinetic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ kinetic-backports main restricted universe multiverse
apt-get update

对于Ubuntu20.10和Ubuntu22.10其源也就一个开发代号不同,可以直接替换代号来更换源:
将/etc/apt/sources.list文件的groovy都替换为kinetic:

# 替换字符串,并更改原文件内容
# 在sed后面加 -i,即编辑文档“edit files in place”选项
sed -i '作用范围s/替换查找目标/替换成为/替换目标option' 文件名
sed -i 's/groovy/kinetic/g' /etc/apt/sources.list
Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐