zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    1065. [Nescafe19] 绿豆蛙的归宿(概率)
    SDOI 2016 Round1 Day2
    SDOI 2016 Round1 Day1
    Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined)
    串 2016Vijos省选集训 day3[AC自动机]
    java连接elastic search 9300
    maven安装,maven命令行使用
    eclipse/IDEA使用maven
    hadoop笔记 基础 归档
    tpot蜜罐平台搭建
  • 原文地址:https://www.cnblogs.com/liujunjun/p/12456071.html
Copyright © 2011-2022 走看看