zoukankan      html  css  js  c++  java
  • Centos7、Ubuntu修改为国内阿里yum源

    一、Centos7更改为国内源

    注意:我通常习惯在系统安装好之后就把源给改过来了,但我习惯创建一个只带基础服务的系统,所以一些常用的功能没有。所以在更改源之前必须保证有wget和vim或vi这两个工具,否则你把yum源改了之后才发现无法获取新的yum源就比较痛苦了

    首先备份本地yum源

     mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak

    获取阿里yum源配置文件

     wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

    运行yum makecache生成缓存

    yum makecache

    更新和升级

    yum update

    二、Ubuntu修改为国内源

    首先查看当前系统代号

    lsb_release -c

    或者

    lsb_release -a

    具体对应代码可参照下表

    版本

    别名(codename)

    发布日期

    4.10

    Warty Warthog(长疣的疣猪)

    2004年10月20日

    5.04

    Hoary Hedgehog(灰白的刺猬)

    2005年4月8日

    5.10

    Breezy Badger(活泼的獾)

    2005年10月13日

    6.06

    Dapper Drake(整洁的公鸭)

    2006年6月1日(LTS)

    6.10

    Edgy Eft(急躁的水蜥)

    2006年10月6日

    7.04

    Feisty Fawn(坏脾气的小鹿)

    2007年4月19日

    7.10

    Gutsy Gibbon(勇敢的长臂猿)

    2007年10月18日

    8.04

    Hardy Heron(耐寒的苍鹭)

    2008年4月24日(LTS)

    8.10

    Intrepid Ibex (勇敢的野山羊)

    2008年10月30日

    9.04

    Jaunty Jackalope(得意洋洋的怀俄明野兔)

    2009年4月23日

    9.10

    Karmic Koala(幸运的考拉)

    2009年10月29日

    10.04

    Lucid Lynx(清醒的猞猁)

    2010年4月29日

    11.10

    Oneiric Ocelot(梦幻的豹猫)

    2010年10月13日

    11.04

    Natty Narwhal(敏捷的独角鲸)

    2011年4月28日

    12.04

    Precise Pangolin(精准的穿山甲)

    2012年的4月26日(LTS)

    12.10

    Quantal Quetzal(量子的绿咬鹃)

    2012年的10月20日

    13.04

    Raring Ringtail(铆足了劲的猫熊)

    2013年4月25日

    13.10

    Saucy Salamander(活泼的蝾螈)

    2013年10月17日

    14.04

    Trusty Tahr (可靠的塔尔羊)

    2014年4月18日 (LTS)

    14.10

    Utopic Unicorn(乌托邦独角兽)

    2014年10月23日

    15.04

    Vivid Vervet (活泼的小猴)

    2015年4月

    15.10

    Wily Werewolf (狡猾的狼人)

    2015年10月

    16.04

    Xenial Xerus (好客的非洲地松鼠)

    2016年4月 (LTS)

    16.10

    Yakkety Yak(牦牛)

    2016年10月

    17.04

    Zesty Zapus(开心的跳鼠)

    2017年4月

    17.10

    Artful Aardvark(机灵的土豚)

    2017年10月

    18.04

    Bionic Beaver(仿生海狸)

    2018年4月(LTS)

    18.10

    Cosmic Cuttlefish (宇宙般大小的乌贼)

    2018年10月

    19.04

    Disco Dingo

    2019年4月

    19.10

    Eoan Ermine

    2019年10月

    ...

    ...

    ...

    这里以Ubuntu18.04为例

    在网上找到阿里源

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

    备份之前的源文件

    sudo cp /etc/apt/souces.list /etc/apt/sources.list_bak

    将新的源复制进去

    sudo vim /etc/apt/sources.list

    然后更新源文件

    sudo apt-get update

    更新软件(如果是生产环境不要轻易更新软件)

    sudo apt-get upgtade
    本文仅为学习交流所用,部分来源于网上整理,文中涉及的环境均为虚拟环境,请勿用于真实生产环境,否则后果自负!所有责任均与本人和平台无关!!! 转载请注明原处!!!
  • 相关阅读:
    【网络流24题----15】汽车加油行驶问题
    【网络流24题】最小路径覆盖问题
    网络流二·最大流最小割定理
    贪吃蛇
    【SCOI2008】着色方案
    DARK的锁链
    【NOIP2014】飞扬的小鸟
    [NOIP2012] 借教室
    [NOIP2012] 开车旅行
    [NOIP2012] 国王游戏
  • 原文地址:https://www.cnblogs.com/maohai-kdg/p/11763324.html
Copyright © 2011-2022 走看看