ubuntu 12.04 apt换源

2021-07 实测可用

前言

本文主要介绍如何为已经不再支持的Ubuntu 12.04LTS 更换源,网上查到的源(很多是13-14年的帖子)都无法直接使用了,例如下面这个

deb http://archive.ubuntu.com/ubuntu precise main universe restricted multiverse

deb http://archive.ubuntu.com/ubuntu precise-security universe main multiverse restricted

deb http://archive.ubuntu.com/ubuntu precise-updates universe main multiverse restricted

deb http://archive.ubuntu.com/ubuntu precise-proposed universe main multiverse restricted

由于12.04不受支持了,12.04相关的这些包的资源被移到了old-releases.ubuntu.com域名下,而不是security.ubuntu.com和 archive.ubuntu.com了,因此需要修改源。使用如下命令修改源:

sudo sed -i.bak -r 's/(archive|security).ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

修改后的源

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

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

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

deb http://old-releases.ubuntu.com/ubuntu precise-proposed universe main multiverse restricted

修改之后之后sudo apt-get update / sudo apt-get upgrade 均可正常执行,其他不受支持的版本也可以进行类似的操作。

参考:

https://gist.github.com/dergachev/f5da514802fcbbb441a1

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值