centos7修改yum源为阿里镜像

mac2022-06-30  115

参考博客:

https://blog.csdn.net/kxwinxp/article/details/78578492

https://blog.csdn.net/inslow/article/details/54177191

需要在root账号下操作

可能新的系统需要开启网络配置,操作如下 ip address #查看网络连接设备 #可以看到两个设备: 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 #那么,有线网就是叫enp1s0啦,(虚拟机一般为 ens33 ) // 打开有线网配置 vi /etc/sysconfig/network-scripts/ifcfg-enp1s0 // 最后一行,修改为YES ONBOOT=YES // 重启网络服务 systemctl restart network.service 备份系统镜像源 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 下载阿里镜像源,如果没有wget,使用yum install wget安装 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 运行yum makecache生成缓存 yum makecache 然后更新 yum update 增加epal源 // 安装epel源 yum install epel-release // 修改为阿里的epel源 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo // 安装yum源优先级管理工具 yum install -y yum-priorities // 添加优先级(数字越小优先级越高) vim /etc/yum.repo.d/epel.repo priority=88 // 添加优先级(这个数要小于epel里的88即可) vim /etc/yum.repo.d/Centos-7.repo priority=6 // 开启yum源优先级功能 vim /etc/yum/pluginconf.d/priorities.conf // 确保文件内容包含如下: [main] enabled=1

<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">

       

转载于:https://www.cnblogs.com/raisok/p/11270629.html

最新回复(0)