【Linux】【Advanced Packaging Tools】Ubuntu 更换软件源镜像

本文记录 Ubuntu 更换镜像源的过程.
使用清华 TUNA 镜像.

1. 受支持的 Ubuntu 更换软件源

对长期支持版本,以 Ubuntu16.04 为例,使用如下步骤修改镜像源.

1. 备份 /etc/apt/sources.list.

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

 
2. 编辑 /etc/apt/sources.list.
 
打开 /etc/apt/sources.list

sudo vim /etc/apt/sources.list

在命令模式下输入 ggdG,删除全部内容.
 
在输入模式下,粘贴复制下列内容:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

Ubuntu 其它版本参看Ubuntu 镜像使用帮助.
 
保存退出.
 
3. 更新

sudo apt update

或者

sudo apt-get update

 
4. 国内其它镜像源

清华源TUNA
科大源UTSC
阿里源aliyun mirror
网易源163 mirror

一般点击 ?help 查看具体的编辑内容

2. 不受支持的 Ubuntu 更换软件源

已经过期的LTS版本或者非LTS版本等不受支持的 Ubuntu 系统,以 Ubuntu12.04 为例,按照下面所述修改镜像源.

修改 /etc/apt/sources.list

  1. 将软件源地址修改为 http://old-releases.ubuntu.com/ubuntu(Ubuntu 官方 old 源)或者 http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu(科大 old 源).
  2. 将 Ubuntu 版本代号改为 precise .
# 默认注释了源码仓库,如有需要可自行取消注释
deb http://old-releases.ubuntu.com/ubuntu/ precise main restricted universe multiverse
# deb-src http://old-releases.ubuntu.com/ubuntu/ precise main restricted universe multiverse

deb http://old-releases.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
# deb-src http://old-releases.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse

deb http://old-releases.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
# deb-src http://old-releases.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse

deb http://old-releases.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
# deb-src http://old-releases.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse

# 预发布软件源,不建议启用
# deb http://old-releases.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
# deb-src http://old-releases.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse

其它操作相同.

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值