ubuntu22.04如何更新镜像源

ubuntu22.04改成国内阿里云源。
先执行命令:lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
gogosai@gogosai-MINI-1900A:~$

看看内核版本(Codename),如果是focal(旧内核版本)

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

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

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

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

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

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

看看内核版本(Codename),如果是 jammy(新内核版本)

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

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

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

deb https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse

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

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

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Ubuntu 22.04 中更换镜像源可以通过以下步骤完成: 1. 打开终端(快捷键:Ctrl+Alt+T)。 2. 备份系统自带的源列表文件,以防出现问题: ``` sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak ``` 3. 打开源列表文件: ``` sudo nano /etc/apt/sources.list ``` 4. 将文件中的原有内容全部删除。 5. 在 sources.list 文件中添加你想要使用的镜像源地址,例如阿里云的源: ``` deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse ``` 这里的 "focal" 是 Ubuntu 22.04 的代号,如果你使用的是其他版本的 Ubuntu,需要将其替换为对应的代号。 6. 保存并退出源列表文件(快捷键:Ctrl+X,然后按 Y 和 Enter)。 7. 更新软件包列表: ``` sudo apt update ``` 如果出现 GPG 错误,可以通过以下命令导入 GPG 密钥: ``` sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys [GPG密钥] ``` 其中 [GPG密钥] 是出现错误的 GPG 密钥。 8. 更新系统软件包: ``` sudo apt upgrade ``` 如果你只想更新特定的软件包,可以使用以下命令: ``` sudo apt install [软件包名称] ``` 其中 [软件包名称] 是你需要更新的软件包名称。 完成以上步骤后,你的 Ubuntu 22.04 系统将会使用新的镜像源地址。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值