• yum使用小巧


    # 安装epel
    yum -y install epel-release
    # 安装dnf,注意需要先安装epel
    yum -y install dnf

    yum只下载不安装

    # centos7下
    yum install --downloadonly --downloaddir=/tmp <package-name>

    yum指定安装本地rpm包

    yum localinstall filename

    挂载本地镜像作为yum源

    cat /etc/yum.repos.d/baseofbase.repo
    [baseofbase]
    name=baseofbase
    # 镜像目录
    baseurl=file:///usr/local/src/centos74
    gpgcheck=0
    enabled=1
    #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

    修改yum源为阿里源

    cd /etc/yum.repos.d 
    # 备份旧的配置文件:
    mv CentOS-Base.repo CentOS-Base.repo.bak 
    # 下载阿里源的文件 
    wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 
    # 清理缓存 
    yum clean all 
    # 重新生成缓存 
    yum makecache

    yum更新时不升级Linux内核

    RedHat/CentOS/Fedora使用 yum update 更新时,默认会 升级内核 。但有些服务器硬件(特别是组装的机器)在升级内核后,新的内核可能会认不出某些硬件,要重新安装驱动,很麻烦。所以在生产环境中不要轻易的升级内核,除非你确定升级内核后不会出现麻烦的问题。

    方法1:修改yum配置

    cp /etc/yum.conf /etc/yum.confbak
    # 在[main]的最后添加
    vim /etc/yum.conf  
    exclude=kernel* 
    exclude=centos-release*

    方法二、直接在yum的命令后面加上如下的参数

    yum --exclude=kernel* update

    # 安装epel yum -y install epel-release # 安装dnf,注意需要先安装epel yum -y install dnf

  • 相关阅读:
    jenkins GitHub 自动触发
    rabbitmq web管理
    系统编码,文件编码,python编码
    反转二叉树
    从右边看二叉树
    python pyenv
    js 闭包
    git review & devops过程
    centos7搭建自己的yum源
    优先级队列PriorityQueue 测试,会自动排序
  • 原文地址:https://www.cnblogs.com/liujunjun/p/12456071.html
Copyright © 2020-2023  润新知