切换Centos的yum源,切换为国内的阿里云源和网易163源

xiaoxiao2021-02-28  124

将CentOS的系统的yum更换为网易和阿里云的yum软件安装源

第一步:备份你的原镜像文件,以免出错后可以恢复。

(使用mv命令,mv有两个作用一个是移动,一个是重命名,这里用到的是重命名的作用)

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

第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/

要查看自己CentOS版本命令

[root@localhost ~]# lsb_release -a

 

开始下载 命令 wget -o 文件名 下载地址 wget命令用于下载 选项-o表示打印日志,可以看到进度 文件名要求为绝对路径. 阿里云 CentOS 5 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo CentOS 6 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 网易163 CentOS 5 wget -O /etc/yum.repos.d/CentOS-163-Base.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo CentOS 6 wget -O /etc/yum.repos.d/CentOS-163-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo CentOS 7 wget -O /etc/yum.repos.d/CentOS-163-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

 

更改CentOS-Media.repo使其为不生效(0表示不生效,1表示生效.不写这句话表示默认生效):

 

enabled=0

第三步:运行yum makecache生成缓存

 

yum clean all yum makecache

个人博客地址:http://blog.qupengwei.top/

转载请注明原文地址: https://www.6miu.com/read-17352.html

最新回复(0)