1 2 3 4 5 6 7 8 |
1.备份本地yum源 [root@bogon ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak 2.获取阿里yum源配置文件 [root@bogon ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 3.更新yum缓存 [root@bogon ~]# yum makecache |
个人自用(直接下载替换掉yum.repos.d 整个目录下文件)
1 2 |
链接:https://pan.baidu.com/s/1Yuw5fj5k2yeGeh4wZuNhZQ 提取码:uitz |
1 2 3 4 5 6 7 8 9 10 11 12 |
#yum install -y wget mkdir /etc/yum.repos.d/repo_bak mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/repo_bak/ #wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #curl http://mirrors.163.com/.help/CentOS7-Base-163.repo -o /etc/yum.repos.d/Centos-7.repo curl http://mirrors.aliyun.com/repo/Centos-7.repo -o /etc/yum.repos.d/Centos-7.repo #yum -y install epel-release curl http://mirrors.aliyun.com/repo/epel-7.repo -o /etc/yum.repos.d/epel-7.repo yum makecache fast&& yum install -y yum-axelget yum install -y yum-utils yum-axelget lrzsz unzip zip htop ntpdate ntp net-tools systemctl restart ntpd && systemctl enable ntpd |
Rockylinux更换yum源
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
https://www.cnblogs.com/wswind/p/15469768.html https://blog.csdn.net/netgc/article/details/117878868 #替换原本的yum源地址 sed -e 's|^mirrorlist=|#mirrorlist=|g' \ -e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux/|g' \ -i.bak \ /etc/yum.repos.d/Rocky-*.repo #创建文件夹并移动备份文件 mkdir /etc/yum.repos.d/repo_bak mv /etc/yum.repos.d/*.bak /etc/yum.repos.d/repo_bak # 生成缓存 dnf makecache #安装epel源 dnf install -y epel-release #替换已经安装的官方源地址 sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel* sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel* #生成缓存 dnf makecache https://mirrors.tuna.tsinghua.edu.cn/epel/RPM-GPG-KEY-EPEL-8 |
出现如下错误拯救办法

1 |
参考:https://blog.csdn.net/qq_26086231/article/details/125750969 |
- 本文固定链接: https://www.yoyoask.com/?p=4116
- 转载请注明: shooter 于 SHOOTER 发表