Centos7更换yum国内源教程

CentOS默认的yum源有时候不是国内镜像,导致yum在线安装及更新速度不是很理想,这时候需要将yum源设置为国内镜像站点(网易or阿里云等)。

更换yum国内源:

1.首先备份系统自带yum源配置文件/etc/yum.repos.d/CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

在这里插入图片描述

2.下载国内yum源配置文件到/etc/yum.repos.d/

阿里源(推荐):
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
网易源:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

在这里插入图片描述

3.清理yum缓存,并生成新的缓存

yum clean all
yum makecache

在这里插入图片描述

4.更新yum源检查是否生效

yum update

在这里插入图片描述

注:
若更新 yum 源不更新内核:
直接在 yum 的命令后面加上如下的参数

yum --exclude=kernel* update

国内yum源:
阿里yum源:http://mirrors.aliyun.com/repo/
163(网易)yum源: http://mirrors.163.com/.help/
中科大的Linux安装镜像源:http://centos.ustc.edu.cn/
搜狐的Linux安装镜像源:http://mirrors.sohu.com/
北京首都在线科技:http://mirrors.yun-idc.com/

本文转载自天乐博客:https://blog.361s.cn/105.html

猜你喜欢

转载自blog.csdn.net/m0_49605975/article/details/120039048