centos7修改yum源为阿里镜像

centos7修改yum源为阿里镜像,第1张

centos7修改yum源为阿里镜像

参考博客:

  • 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://outofmemory.cn/zaji/586830.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-12
下一篇 2022-04-12

发表评论

登录后才能评论

评论列表(0条)

保存