ubuntu换源 16.04、18.04 换国内源

网上有各种换源的方法,但很少提到一些必须要注意的细节,例如到底是哪个版本的源,这里进行补充说明,并给出具体执行方法以供参考学习。

1、注意事项

ubuntu至今已经发布30多个版本,目前常见的大部分都是16.04版本和18.04版本。16、18是版本号码,每个版本又有以动物命名的别称,而换源时的网址也主要是根据这个别称决定下载分支的,如下述换源语句中的红色部分。因此换源,必须要仔细检查这个别称,匹配自己的Ubuntu版本,否则肯定会出错误。

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse  --【16.04】
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse  --【18.04】

部分版本号与别称如下(参考了https://blog.csdn.net/zhengmx100/article/details/78352773):

2、换源

国内的源有阿里云、中科大、清华、163...的。经过实践,这里只提供阿里云的,也避免选择困难。

  • 16.04(即xenial)换源

将/etc/apt中的sources.list文件中内容全部换为以下内容。并执行 sudo apt-get update ,则换源结束。

另:sudo apt-get update这个命令是将本地的软件和源网址的软件版本进行核对;sudo apt-get upgrade是将本地的软件版本升级为源网站上的最新版本,如果不想对软件升级只想换源不用执行该命令。

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

 

  • 18.04(即bionic)换源

将/etc/apt中的sources.list文件中内容全部换为以下内容。并执行 sudo apt-get update ,则换源结束。

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

 

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值