zoukankan      html  css  js  c++  java
  • 18.【原创】Ubuntu下切换apt的源为阿里源

    1.先查看当前系统的版本号,ubuntu的每个大版本所对应的代号(Codename的值后面会用到)是不一样的,需要使用如下命令查看:

    root@ubuntu-xenial:/etc/apt# lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 16.04.6 LTS
    Release:        16.04
    Codename:       xenial
    

      1.1.各个版本对应的代号(Codename

    序号 版本号 代号(Codename)
    1

    Ubuntu 12.04 (LTS)

    precise
    2

    Ubuntu 14.04 (LTS)

    trusty
    3

    Ubuntu 15.04

    vivid
    4

    Ubuntu 15.10

    wily
    5

    Ubuntu 16.04 (LTS)

    xenial
    6

    Ubuntu 18.04 (LTS)

    bionic
    7 Ubuntu 19.10 eoan

    2.找切换到源配置文件的目录,对源文件进行备份,出错时可回滚。如果没有配置文件,则需要创建:

    root@ubuntu-xenial:/# cd /etc/apt
    root@ubuntu-xenial:/etc/apt# sudo mv sources.list sources.list.bak
    root@ubuntu-xenial:/etc/apt# 
    

      

    3.使用“sudo vi sources.list”指令,将如下阿里的源镜像地址写入到源配置文件中,我目前所有的版本代号为“xenial”所以源地址配置中会带代号标识符,其他版本的可对应替换标识符即可:

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

      

    4.更新apt的源配置:

    sudo apt-get update
    

      

  • 相关阅读:
    正则表达式---用户验证
    最短路 Dijkstra
    最短路 Dijkstra+堆优化
    LCIS(最长公共上升子序列)
    最小生成树 Kruskal
    网络流 最大流
    网络流 最小费用最大流
    树链剖分
    树状数组
    双重Hash
  • 原文地址:https://www.cnblogs.com/Nick-Hu/p/13282051.html
Copyright © 2011-2022 走看看