• 更改和配置本地yum源


    查看yum 存放位置

    [root@web01 yum.repos.d]# ll /etc/yum.repos.d/
    total 28
    -rw-r--r--. 1 root root 2523 Jun 16  2018 CentOS-Base.repo  网络源
    -rw-r--r--. 1 root root  647 Mar 28  2017 CentOS-Debuginfo.repo
    -rw-r--r--. 1 root root  289 Mar 28  2017 CentOS-fasttrack.repo
    -rw-r--r--. 1 root root  630 Mar 28  2017 CentOS-Media.repo 本地源
    -rw-r--r--. 1 root root 7989 Mar 28  2017 CentOS-Vault.repo
    -rw-r--r--. 1 root root  664 May 11  2018 epel.repo

    查看网络源详细的配置源信息

    [root@web01 yum.repos.d]# cat CentOS-Base.repo 
    [base]
    name=CentOS-$releasever - Base - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
            http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
            http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
    gpgcheck=1
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
     
    #released updates 
    [updates]
    name=CentOS-$releasever - Updates - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
            http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
            http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
    gpgcheck=1
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
     
    #additional packages that may be useful
    [extras]
    name=CentOS-$releasever - Extras - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
            http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
            http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
    gpgcheck=1
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
     
    #additional packages that extend functionality of existing packages
    [centosplus]
    name=CentOS-$releasever - Plus - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
            http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
            http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
     
    #contrib - packages by Centos Users
    [contrib]
    name=CentOS-$releasever - Contrib - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
            http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
            http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
    [root@web01 yum.repos.d]#

    只要修改baseurl gpgkey 为相应源地址即可。

    查看本地源的详细信息

    [root@web01 ~]# cat /etc/yum.repos.d/CentOS-Media.repo 
    # CentOS-Media.repo
    #
    #  This repo can be used with mounted DVD media, verify the mount point for
    #  CentOS-6.  You can use this repo and yum to install items directly off the
    #  DVD ISO that we release.
    #
    # To use this repo, put in your DVD and use it with the other repos too:
    #  yum --enablerepo=c6-media [command]
    #  
    # or for ONLY the media repo, do this:
    #
    #  yum --disablerepo=* --enablerepo=c6-media [command]
     
    [c6-media]
    name=CentOS-$releasever - Media
    baseurl=file:///media/CentOS/
            file:///media/cdrom/
            file:///media/cdrecorder/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

    修改为本地源地址 

    以上配置结束之后,要清空yum 缓存,并重建yum缓存,执行以下命令:

    yum clean all && yum clean metadata && yum clean dbcache && yum makecache && yum update

    Linux升级命令有两个分别是yum upgrade和yum update, 这个两个命令是有区别的:

    yum -y update

    升级所有包同时也升级软件和系统内核

    yum -y upgrade

    只升级所有包,不升级软件和系统内核

    实验分别测试 yum -y upgrade和yum -y update

    升级前

    系统版本: centos5.5 
    内核版本: 2.6.18-194.el5 
    升级前做过简单配置文件修改

    yum -y upgrade 升级后

    系统版本: centos5.7 
    内核版本: 2.6.18-194.el5 
    yum -y update 升级后

    系统版本: centos5.7 
    内核版本: 2.6.18-238.el5

    清空yum缓存

    yum clean all

  • 相关阅读:
    第九章 读书笔记
    第八章 读书笔记
    第七章 读书笔记
    第六章 读书笔记
    第五章 读书笔记
    第四章读书笔记
    第三章读书笔记
    第九章 硬件抽象层:HAL
    第10章 嵌入式linux的调试技术
    第八章 蜂鸣器驱动
  • 原文地址:https://www.cnblogs.com/imp-W/p/11393800.html
Copyright © 2020-2023  润新知