ubuntu更换apt源

将ubuntu的apt设置为国内的源(阿里)

  1. 备份系统自带源
    1
    mv /etc/apt/sources.list /etc/apt/sources.list.bak
  2. 修改/etc/apt/sources.list文件
    1
    vim /etc/apt/sources.list
    加入如下内容:
    1
    deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
    2
    deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
    3
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
    4
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
    5
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
    6
    deb http://mirrors.aliyun.com/ubuntu/ xenial universe
    7
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
    8
    deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
    9
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
    10
    deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
    11
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
    12
    deb http://archive.canonical.com/ubuntu xenial partner
    13
    deb-src http://archive.canonical.com/ubuntu xenial partner
    14
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
    15
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
    16
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
    17
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
  3. 更新生效
    1
    apt-get update