• 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
    

      

  • 相关阅读:
    一些shell脚本实例
    python 创建虚拟环境python –m venv方式
    jmeter 压测的执行步骤步骤
    jmeter dubbo测试
    python 时间戳转日期 不自动补零 without zero-padding
    windows jetbrains toolbox 无法修改应用安装目录(应用正在运行)的解决方案
    【摘】人生苦短, 每日python
    【摘】人生苦短, 每日python
    【摘】人生苦短,每日python
    【摘】人生苦短,每日python
  • 原文地址:https://www.cnblogs.com/Nick-Hu/p/13282051.html
Copyright © 2020-2023  润新知