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
    

      

  • 相关阅读:
    Web下的HTTPS应用
    laravel用crud之index列出产品items
    laravel用crud修改产品items-新建resource controller和routing
    用laravel dingo/api创建产品api
    用laravel dingo/api创建简单的api
    composer错误提示Cloning failed using an ssh key for authentication的解决方法
    防止SQL注入的6个要点
    magento 2.3安装测试数据
    教你一步步composer安装Magento2.3
    30个redis.conf 配置项说明
  • 原文地址:https://www.cnblogs.com/Nick-Hu/p/13282051.html
Copyright © 2011-2022 走看看