Linux ubuntu 切换阿里更新源

文章出处:https://www.cnblogs.com/lyon2014/p/4715379.html

如国内网络使用ubuntu 则会出现apt-get无法安装更新的问题,这时大家需要切换到一些国内第三方更新源。

  1. 首先查看自己的ubuntu系统的codename,直接导致你更新的源是否对你的系统起效果,查看方法: lsb_release -a
    Linux ubuntu 切换阿里更新源_第1张图片
    我的系统显示:Codename: bionic
  2. 确认阿里源支持
    登陆以下网页:http://mirrors.aliyun.com/ubuntu/dists/
    该网页显示了阿里云支持的ubuntu系统下各个Codename版本,确保自己的Codename在该网页中存在(一般都会有的)

  3. 备份系统源:
    cd /etc/apt
    sudo mv sources.list sources.list_bak

  4. 添加新的源文件:sudo vi sources.list
    并添加以下内容:注意,每一行的trusty应该用第一步查看得到的Codename来代替
    deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
    deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
    deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
    deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
    deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
    deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
    deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
    deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
    deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
    deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

  5. 保存并且sudo apt-get update,更新成功

你可能感兴趣的:(linux)