Ubuntu通过终端命令行换阿里源(顺带解决ubuntu过时版本问题)

1.检查Ubuntu系统的Codename

$ lsb_release -a

得到结果:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 17.10
Release:        17.10
Codename:       artful

访问http://mirrors.aliyun.com/ubuntu/dists/查看阿里源是否支持

修改sources.list

$ sudo vi /etc/apt/sources.list

删除sources.list中原有的内容,更换为阿里源

deb http://mirrors.aliyun.com/ubuntu/ artful main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ artful main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ artful-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ artful-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ artful-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ artful-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ artful-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ artful-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ artful-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ artful-proposed main restricted universe multiverse

注意此处每一行的artful都需要与系统的Codename相对应,因此不同系统版本间的sources.list文件不能通用

         注意下17.10版本,虽然看到http://mirrors.aliyun.com/ubuntu/dists/里有,但其实还是用不了的。

         

会报错

  dminz@u211 /etc/apt]$sudo apt-get update
Ign:1 http://mirrors.aliyun.com/ubuntu/dists artful InRelease
Ign:2 http://mirrors.aliyun.com/ubuntu/dists artful-security InRelease
Ign:3 http://mirrors.aliyun.com/ubuntu/dists artful-updates InRelease
Ign:4 http://mirrors.aliyun.com/ubuntu/dists artful-backports InRelease
Ign:5 http://mirrors.aliyun.com/ubuntu/dists artful-proposed InRelease
Err:6 http://mirrors.aliyun.com/ubuntu/dists artful Release
  404  Not Found [IP: 183.240.176.117 80]
Err:7 http://mirrors.aliyun.com/ubuntu/dists artful-security Release
  404  Not Found [IP: 183.240.176.117 80]
Err:8 http://mirrors.aliyun.com/ubuntu/dists artful-updates Release
  404  Not Found [IP: 183.240.176.117 80]
Err:9 http://mirrors.aliyun.com/ubuntu/dists artful-backports Release
  404  Not Found [IP: 183.240.176.117 80]
Err:10 http://mirrors.aliyun.com/ubuntu/dists artful-proposed Release
  404  Not Found [IP: 183.240.176.117 80]
Reading package lists... Done
E: The repository 'http://mirrors.aliyun.com/ubuntu/dists artful Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.aliyun.com/ubuntu/dists artful-security Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.aliyun.com/ubuntu/dists artful-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.aliyun.com/ubuntu/dists artful-backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.aliyun.com/ubuntu/dists artful-proposed Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

原因是17.10等非主流版本已经不支持了,解决办法看链接,简单来说就是需要换域名名字为 old-releases.ubuntu.com

实际上 17.10源

deb http://old-releases.ubuntu.com/ubuntu/ artful main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ artful main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ artful-security main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ artful-security main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ artful-updates main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ artful-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ artful-backports main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ artful-backports main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ artful-proposed main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ artful-proposed main restricted universe multiverse

 

更新源

$ sudo apt-get update

更新软件

$ sudo apt-get upgrade
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AllenLeungX

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值