zoukankan      html  css  js  c++  java
  • 更新阿里yum源并重建缓存

    【第一种方式】
    1、下载安装wget /如果没有装的话
    yum install -y wget

    2、备份默认的yum
    mv /etc/yum.repos.d /etc/yum.repos.d.backup

    3、设置新的yum目录
    mkdir /etc/yum.repos.d

    4、下载阿里yum配置到该目录中,选择对应版本
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    或者
    将 https://mirrors.tuna.tsinghua.edu.cn/help/centos/ 中的内容粘贴到 CentOS-Base.repo

    5、重建缓存
    yum clean all
    yum makecache fast

    6、升级所有包(改变软件设置和系统设置,系统版本内核都升级,故需要几分钟耐心等待)
    yum update -y

    【第二种方式】
    --脚本
    vi yum.sh

    #!/bin/bash
    mv /etc/yum.repos.d/* /mnt
    a=`cat /etc/redhat-release |awk '{print $3}'|awk -F . '{print $1}'`
    if [ $a == 6 ];then
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    else
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    fi
    yum clean all
    yum makecache fast

    --授权
    chmod 777 yum.sh

    --执行
    ./yum.sh

    --升级包
    yum update -y

    转自centos 7 部署 汉化版 gitlab
    https://www.cnblogs.com/straycats/p/7637373.html

  • 相关阅读:
    嵌入式驱动视频2019.03.24
    wps如何输入连续的长破折号
    python绘图问题
    2.13
    2.12
    2.10
    2.9
    2.8
    2.7
    2.5
  • 原文地址:https://www.cnblogs.com/ritchy/p/11747697.html
Copyright © 2011-2022 走看看